<html><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Chapter 22. PHPUnit API</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <link rel="stylesheet" href="docbook.css" tppabs="http://www.phpunit.de/manual/current/en/docbook.css" type="text/css"></link>
</head>
<body>

<div id="header">
  <h1>PHPUnit Manual</h1>

  <ul>
<li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.4/en/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.4/en/index.html'" tppabs="http://www.phpunit.de/manual/3.4/en/index.html">PHPUnit 3.4 <span><small>English</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.3/en/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.3/en/index.html'" tppabs="http://www.phpunit.de/manual/3.3/en/index.html" class="active">PHPUnit 3.3 <span><small>English</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.2/en/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.2/en/index.html'" tppabs="http://www.phpunit.de/manual/3.2/en/index.html">PHPUnit 3.2 <span><small>English</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.1/en/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.1/en/index.html'" tppabs="http://www.phpunit.de/manual/3.1/en/index.html">PHPUnit 3.1 <span><small>English</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.0/en/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.0/en/index.html'" tppabs="http://www.phpunit.de/manual/3.0/en/index.html">PHPUnit 3.0 <span><small>English</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/2.3/en/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/2.3/en/index.html'" tppabs="http://www.phpunit.de/manual/2.3/en/index.html">PHPUnit 2.3 <span><small>English</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.3/ja/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.3/ja/index.html'" tppabs="http://www.phpunit.de/manual/3.3/ja/index.html">PHPUnit 3.3 <span><small>Japanese</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.2/ja/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.2/ja/index.html'" tppabs="http://www.phpunit.de/manual/3.2/ja/index.html">PHPUnit 3.2 <span><small>Japanese</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.1/ja/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.1/ja/index.html'" tppabs="http://www.phpunit.de/manual/3.1/ja/index.html">PHPUnit 3.1 <span><small>Japanese</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.0/ja/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.0/ja/index.html'" tppabs="http://www.phpunit.de/manual/3.0/ja/index.html">PHPUnit 3.0 <span><small>Japanese</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/2.3/ja/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/2.3/ja/index.html'" tppabs="http://www.phpunit.de/manual/2.3/ja/index.html">PHPUnit 2.3 <span><small>Japanese</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/2.3/de/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/2.3/de/index.html'" tppabs="http://www.phpunit.de/manual/2.3/de/index.html">PHPUnit 2.3 <span><small>German</small></span></a></li>
  </ul>
</div>
<div class="colmask leftmenu">
  <div class="colleft">
    <div class="col1">
      <table border="0" width="100%">
        <tr>
          <td align="left"><a accesskey="p" href="continuous-integration.html" tppabs="http://www.phpunit.de/manual/current/en/continuous-integration.html">Prev</a></td>
          <td align="right"><a accesskey="n" href="extending-phpunit.html" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html">Next</a></td>
        </tr>
      </table>
<div class="chapter" title="Chapter 22. PHPUnit API"><div class="titlepage"><div><div><h2 class="title"><a id="api"></a>Chapter 22. PHPUnit API</h2></div></div></div><p>
    For most uses, PHPUnit has a simple API: subclass
    <code class="literal">PHPUnit_Framework_TestCase</code> for your test cases and
    call <code class="literal">assertTrue()</code> or <code class="literal">assertEquals()</code>.
    However, for those of you who would like to look deeper into PHPUnit,
    here are all of its published methods and classes.
  </p><div class="section" title="Overview"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="api.overview"></a>Overview</h2></div></div></div><p>
      Most of the time, you will encounter five classes or interfaces when you
      are using PHPUnit:
    </p><div class="variablelist"><dl><dt><span class="term"><code class="literal">PHPUnit_Framework_Assert</code></span></dt><dd><p>
          A collection of static methods for checking actual values against
          expected values.
          </p></dd><dt><span class="term"><code class="literal">PHPUnit_Framework_Test</code></span></dt><dd><p>
            The interface of all objects that act like tests.
          </p></dd><dt><span class="term"><code class="literal">PHPUnit_Framework_TestCase</code></span></dt><dd><p>
            A single test.
          </p></dd><dt><span class="term"><code class="literal">PHPUnit_Framework_TestSuite</code></span></dt><dd><p>
            A collection of tests.
          </p></dd><dt><span class="term"><code class="literal">PHPUnit_Framework_TestResult</code></span></dt><dd><p>
            A summary of the results of running one or more tests.
          </p></dd></dl></div><p>
      <a class="xref" href="api.html#api.overview.figures.PHPUnit_Framework.png" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.overview.figures.PHPUnit_Framework.png" title="Figure 22.1. The five basic classes and interfaces in PHPUnit">Figure 22.1</a>
      shows the relationship of the five basic classes and interfaces
      in PHPUnit: <code class="literal">PHPUnit_Framework_Assert</code>,
      <code class="literal">PHPUnit_Framework_Test</code>,
      <code class="literal">PHPUnit_Framework_TestCase</code>,
      <code class="literal">PHPUnit_Framework_TestSuite</code>, and
      <code class="literal">PHPUnit_Framework_TestResult</code>.
    </p><div class="figure"><a id="api.overview.figures.PHPUnit_Framework.png"></a><p class="title"><b>Figure 22.1. The five basic classes and interfaces in PHPUnit</b></p><div class="figure-contents"><div><img src="figures/PHPUnit_Framework.png" tppabs="http://www.phpunit.de/manual/current/en/figures/PHPUnit_Framework.png" alt="The five basic classes and interfaces in PHPUnit"></img></div></div></div><br class="figure-break"></br></div><div class="section" title="PHPUnit_Framework_Assert"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="api.assert"></a>PHPUnit_Framework_Assert</h2></div></div></div><a id="id2578495" class="indexterm"></a><p>
      <a id="id2578504" class="indexterm"></a>
      <a id="id2578511" class="indexterm"></a>

      Most test cases written for PHPUnit are derived indirectly from the class
      <code class="literal">PHPUnit_Framework_Assert</code>, which contains methods for
      automatically checking values and reporting discrepancies. The methods
      are declared static, so you can write design-by-contract style
      assertions in your methods and have them reported through PHPUnit
      (<a class="xref" href="api.html#api.assert.examples.Sample.php" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.examples.Sample.php" title="Example 22.1: Design-by-Contract Style Assertions">Example 22.1</a>).
    </p><div class="example"><a id="api.assert.examples.Sample.php"></a><p class="title"><b>Example 22.1: Design-by-Contract Style Assertions</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">require_once</span><span class="default">&nbsp;</span><span class="string">'PHPUnit/Framework.php'</span><span class="keyword">;</span><br />&nbsp;<br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">Sample</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">aSampleMethod</span><span class="keyword">(</span><span class="default">$object</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">PHPUnit_Framework_Assert</span><span class="keyword">::</span><span class="default">assertNotNull</span><span class="keyword">(</span><span class="default">$object</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br />&nbsp;<br /><span class="default">$sample</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">new</span><span class="default">&nbsp;</span><span class="default">Sample</span><span class="keyword">;</span><br /><span class="default">$sample</span><span class="keyword">-&gt;</span><span class="default">aSampleMethod</span><span class="keyword">(</span><span class="default">NULL</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen">Fatal error: Uncaught exception 'PHPUnit_Framework_ExpectationFailedException'
with message 'Failed asserting that &lt;null&gt; is not identical to &lt;null&gt;.'</pre></div></div><br class="example-break"></br><p>
      Most of the time, though, you'll be checking the assertions inside of
      tests.
    </p><p>
      There are two variants of each of the assertion methods: one takes a
      message to be displayed with the error as a parameter, and one does not.
      The optional message is typically displayed when a failure is displayed,
      which can make debugging easier.
    </p><div class="example"><a id="api.assert.examples.MessageTest.php"></a><p class="title"><b>Example 22.2: Using assertions with messages</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">require_once</span><span class="default">&nbsp;</span><span class="string">'PHPUnit/Framework.php'</span><span class="keyword">;</span><br />&nbsp;<br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">MessageTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testMessage</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertTrue</span><span class="keyword">(</span><span class="default">FALSE</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'This&nbsp;is&nbsp;a&nbsp;custom&nbsp;message.'</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre></div></div><br class="example-break"></br><p>
      The following example shows the output you get when you run the
      <code class="literal">testMessage()</code> test from
      <a class="xref" href="api.html#api.assert.examples.MessageTest.php" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.examples.MessageTest.php" title="Example 22.2: Using assertions with messages">Example 22.2</a>, using
      assertions with messages:
    </p><pre class="screen"><strong class="userinput"><code>phpunit MessageTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testMessage(MessageTest)
This is a custom message.
Failed asserting that &lt;boolean:false&gt; is true.
/home/sb/MessageTest.php:8

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre><p>
      Below are all the varieties of assertions.
    </p><div class="section" title="assertArrayHasKey()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertArrayHasKey"></a><code class="literal">assertArrayHasKey()</code></h3></div></div></div><a id="id2578644" class="indexterm"></a><a id="id2578651" class="indexterm"></a><p><code class="literal">assertArrayHasKey(mixed $key, array $array[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if <code class="literal">$array</code> does not have the <code class="literal">$key</code>.</p><p><code class="literal">assertArrayNotHasKey()</code> is the inverse of this assertion and takes the same arguments.</p><div class="example"><a id="api.assert.assertArrayHasKey.example"></a><p class="title"><b>Example 22.3: Usage of assertArrayHasKey()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">ArrayHasKeyTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertArrayHasKey</span><span class="keyword">(</span><span class="string">'foo'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><span class="string">'bar'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'baz'</span><span class="keyword">)</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit ArrayHasKeyTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(ArrayHasKeyTest)
Failed asserting that an array has the key &lt;string:foo&gt;.
/home/sb/ArrayHasKeyTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertClassHasAttribute()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertClassHasAttribute"></a><code class="literal">assertClassHasAttribute()</code></h3></div></div></div><a id="id2578740" class="indexterm"></a><a id="id2578748" class="indexterm"></a><p><code class="literal">assertClassHasAttribute(string $attributeName, string $className[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if <code class="literal">$className::attributeName</code> does not exist.</p><p><code class="literal">assertClassNotHasAttribute()</code> is the inverse of this assertion and takes the same arguments.</p><div class="example"><a id="api.assert.assertClassHasAttribute.example"></a><p class="title"><b>Example 22.4: Usage of assertClassHasAttribute()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">ClassHasAttributeTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertClassHasAttribute</span><span class="keyword">(</span><span class="string">'foo'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'stdClass'</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit ClassHasAttributeTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(ClassHasAttributeTest)
Failed asserting that class "stdClass" has attribute "foo".
/home/sb/ClassHasAttributeTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertClassHasStaticAttribute()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertClassHasStaticAttribute"></a><code class="literal">assertClassHasStaticAttribute()</code></h3></div></div></div><a id="id2578834" class="indexterm"></a><a id="id2578841" class="indexterm"></a><p><code class="literal">assertClassHasStaticAttribute(string $attributeName, string $className[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if <code class="literal">$className::attributeName</code> does not exist.</p><p><code class="literal">assertClassNotHasStaticAttribute()</code> is the inverse of this assertion and takes the same arguments.</p><div class="example"><a id="api.assert.assertClassHasStaticAttribute.example"></a><p class="title"><b>Example 22.5: Usage of assertClassHasStaticAttribute()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">ClassHasStaticAttributeTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertClassHasStaticAttribute</span><span class="keyword">(</span><span class="string">'foo'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'stdClass'</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit ClassHasStaticAttributeTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(ClassHasStaticAttributeTest)
Failed asserting that class "stdClass" has static attribute "foo".
/home/sb/ClassHasStaticAttributeTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertContains()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertContains"></a><code class="literal">assertContains()</code></h3></div></div></div><a id="id2578928" class="indexterm"></a><a id="id2578935" class="indexterm"></a><a id="id2578942" class="indexterm"></a><a id="id2578949" class="indexterm"></a><p><code class="literal">assertContains(mixed $needle, Iterator|array $haystack[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if <code class="literal">$needle</code> is not an element of <code class="literal">$haystack</code>.</p><p><code class="literal">assertNotContains()</code> is the inverse of this assertion and takes the same arguments.</p><p><code class="literal">assertAttributeContains()</code> and <code class="literal">assertAttributeNotContains()</code> are convenience wrappers that use a <code class="literal">public</code>, <code class="literal">protected</code>, or <code class="literal">private</code> attribute of a class or object as the haystack.</p><div class="example"><a id="api.assert.assertContains.example"></a><p class="title"><b>Example 22.6: Usage of assertContains()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">ContainsTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertContains</span><span class="keyword">(</span><span class="default">4</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><span class="default">1</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">2</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">3</span><span class="keyword">)</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit ContainsTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(ContainsTest)
Failed asserting that an array contains &lt;integer:4&gt;.
/home/sb/ContainsTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br><p><code class="literal">assertContains(string $needle, string $haystack[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if <code class="literal">$needle</code> is not a substring of <code class="literal">$haystack</code>.</p><div class="example"><a id="api.assert.assertContains.example2"></a><p class="title"><b>Example 22.7: Usage of assertContains()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">ContainsTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertContains</span><span class="keyword">(</span><span class="string">'baz'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'foobar'</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit ContainsTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(ContainsTest)
Failed asserting that &lt;string:foobar&gt; contains "baz".
/home/sb/ContainsTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertContainsOnly()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertContainsOnly"></a><code class="literal">assertContainsOnly()</code></h3></div></div></div><a id="id2579133" class="indexterm"></a><a id="id2579140" class="indexterm"></a><a id="id2579147" class="indexterm"></a><a id="id2579154" class="indexterm"></a><p><code class="literal">assertContainsOnly(string $type, Iterator|array $haystack[, boolean $isNativeType = NULL, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if <code class="literal">$haystack</code> does not contain only variables of type <code class="literal">$type</code>.</p><p><code class="literal">$isNativeType</code> is a flag used to indicate whether <code class="literal">$type</code> is a native PHP type or not.</p><p><code class="literal">assertNotContainsOnly()</code> is the inverse of this assertion and takes the same arguments.</p><p><code class="literal">assertAttributeContainsOnly()</code> and <code class="literal">assertAttributeNotContainsOnly()</code> are convenience wrappers that use a <code class="literal">public</code>, <code class="literal">protected</code>, or <code class="literal">private</code> attribute of a class or object as the actual value.</p><div class="example"><a id="api.assert.assertContainsOnly.example"></a><p class="title"><b>Example 22.8: Usage of assertContainsOnly()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">ContainsOnlyTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertContainsOnly</span><span class="keyword">(</span><span class="string">'string'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><span class="string">'1'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'2'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">3</span><span class="keyword">)</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit ContainsOnlyTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(ContainsOnlyTest)
Failed asserting that 
Array
(
    [0] =&gt; 1
    [1] =&gt; 2
    [2] =&gt; 3
)
 contains only values of type "string".
/home/sb/ContainsOnlyTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertEqualXMLStructure()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertEqualXMLStructure"></a><code class="literal">assertEqualXMLStructure()</code></h3></div></div></div><a id="id2579297" class="indexterm"></a><p><code class="literal">assertEqualXMLStructure(DOMNode $expectedNode, DOMNode $actualNode[, boolean $checkAttributes = FALSE, string $message = ''])</code></p><p>XXX</p><div class="example"><a id="api.assert.assertEqualXMLStructure.example"></a><p class="title"><b>Example 22.9: Usage of assertEqualXMLStructure()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit EqualXMLStructureTest</code></strong>
</pre></div></div><br class="example-break"></br></div><div class="section" title="assertEquals()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertEquals"></a><code class="literal">assertEquals()</code></h3></div></div></div><a id="id2579355" class="indexterm"></a><a id="id2579362" class="indexterm"></a><a id="id2579369" class="indexterm"></a><a id="id2579376" class="indexterm"></a><p><code class="literal">assertEquals(mixed $expected, mixed $actual[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the two variables <code class="literal">$expected</code> and <code class="literal">$actual</code> are not equal.</p><p><code class="literal">assertNotEquals()</code> is the inverse of this assertion and takes the same arguments.</p><p><code class="literal">assertAttributeEquals()</code> and <code class="literal">assertAttributeNotEquals()</code> are convenience wrappers that use a <code class="literal">public</code>, <code class="literal">protected</code>, or <code class="literal">private</code> attribute of a class or object as the actual value.</p><div class="example"><a id="api.assert.assertEquals.example"></a><p class="title"><b>Example 22.10: Usage of assertEquals()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">EqualsTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertEquals</span><span class="keyword">(</span><span class="default">1</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">0</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure2</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertEquals</span><span class="keyword">(</span><span class="string">'bar'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'baz'</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure3</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertEquals</span><span class="keyword">(</span><span class="string">&quot;foo\nbar\nbaz\n&quot;</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">&quot;foo\nbah\nbaz\n&quot;</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit EqualsTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

FFF

Time: 0 seconds

There were 3 failures:

1) testFailure(EqualsTest)
Failed asserting that &lt;integer:0&gt; matches expected value &lt;integer:1&gt;.
/home/sb/EqualsTest.php:11

2) testFailure2(EqualsTest)
Failed asserting that two strings are equal.
expected string &lt;bar&gt;
difference      &lt;  x&gt;
got string      &lt;baz&gt;
/home/sb/EqualsTest.php:16

3) testFailure3(EqualsTest)
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ -1,3 +1,3 @@
 foo
-bar
+bah
 baz

/home/sb/EqualsTest.php:21

FAILURES!
Tests: 3, Assertions: 3, Failures: 3.</pre></div></div><br class="example-break"></br><p>More specialized comparisons are used for specific argument types for <code class="literal">$expected</code> and <code class="literal">$actual</code>, see below.</p><p><code class="literal">assertEquals(float $expected, float $actual[, string $message = '', float $delta = 0])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the two floats <code class="literal">$expected</code> and <code class="literal">$actual</code> are not within <code class="literal">$delta</code> of each other.</p><p>Please read about <a class="ulink" href="javascript:if(confirm('http://en.wikipedia.org/wiki/IEEE_754  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://en.wikipedia.org/wiki/IEEE_754#Comparing_floating-point_numbers'" tppabs="http://en.wikipedia.org/wiki/IEEE_754#Comparing_floating-point_numbers" target="_top">comparing floating-point numbers</a> to understand why <code class="literal">$delta</code> is neccessary.</p><div class="example"><a id="api.assert.assertEquals.example2"></a><p class="title"><b>Example 22.11: Usage of assertEquals() with floats</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">EqualsTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testSuccess</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertEquals</span><span class="keyword">(</span><span class="default">1.0</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1.1</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">''</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">0.2</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertEquals</span><span class="keyword">(</span><span class="default">1.0</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1.1</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit EqualsTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

.F

Time: 0 seconds

There was 1 failure:

1) testFailure(EqualsTest)
Failed asserting that &lt;double:1.1&gt; matches expected value &lt;double:1&gt;.
/home/sb/EqualsTest.php:11

FAILURES!
Tests: 2, Assertions: 2, Failures: 1.</pre></div></div><br class="example-break"></br><p><code class="literal">assertEquals(DOMDocument $expected, DOMDocument $actual[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the XML documents represented by the two DOMDocument objects <code class="literal">$expected</code> and <code class="literal">$actual</code> are not equal.</p><div class="example"><a id="api.assert.assertEquals.example3"></a><p class="title"><b>Example 22.12: Usage of assertEquals() with DOMDocument objects</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">EqualsTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$expected</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">new</span><span class="default">&nbsp;</span><span class="default">DOMDocument</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$expected</span><span class="keyword">-&gt;</span><span class="default">loadXML</span><span class="keyword">(</span><span class="string">'&lt;foo&gt;&lt;bar/&gt;&lt;/foo&gt;'</span><span class="keyword">)</span><span class="keyword">;</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$actual</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">new</span><span class="default">&nbsp;</span><span class="default">DOMDocument</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$actual</span><span class="keyword">-&gt;</span><span class="default">loadXML</span><span class="keyword">(</span><span class="string">'&lt;bar&gt;&lt;foo/&gt;&lt;/bar&gt;'</span><span class="keyword">)</span><span class="keyword">;</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertEquals</span><span class="keyword">(</span><span class="default">$expected</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">$actual</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit EqualsTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(EqualsTest)
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ -1,4 +1,4 @@
 &lt;?xml version="1.0"?&gt;
-&lt;foo&gt;
-  &lt;bar/&gt;
-&lt;/foo&gt;
+&lt;bar&gt;
+  &lt;foo/&gt;
+&lt;/bar&gt;

/home/sb/EqualsTest.php:12

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br><p><code class="literal">assertEquals(object $expected, object $actual[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the two objects <code class="literal">$expected</code> and <code class="literal">$actual</code> do not have equal attribute values.</p><div class="example"><a id="api.assert.assertEquals.example4"></a><p class="title"><b>Example 22.13: Usage of assertEquals() with objects</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">EqualsTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$expected</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">new</span><span class="default">&nbsp;</span><span class="default">stdClass</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$expected</span><span class="keyword">-&gt;</span><span class="default">foo</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="string">'foo'</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$expected</span><span class="keyword">-&gt;</span><span class="default">bar</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="string">'bar'</span><span class="keyword">;</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$actual</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">new</span><span class="default">&nbsp;</span><span class="default">stdClass</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$actual</span><span class="keyword">-&gt;</span><span class="default">foo</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="string">'bar'</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$actual</span><span class="keyword">-&gt;</span><span class="default">baz</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="string">'bar'</span><span class="keyword">;</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertEquals</span><span class="keyword">(</span><span class="default">$expected</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">$actual</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit EqualsTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(EqualsTest)
Failed asserting that two objects are equal.
--- Expected
+++ Actual
@@ -1,5 +1,5 @@
 stdClass Object
 (
-    [foo] =&gt; foo
-    [bar] =&gt; bar
+    [foo] =&gt; bar
+    [baz] =&gt; bar
 )

/home/sb/EqualsTest.php:14

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br><p><code class="literal">assertEquals(array $expected, array $actual[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the two arrays <code class="literal">$expected</code> and <code class="literal">$actual</code> are not equal.</p><div class="example"><a id="api.assert.assertEquals.example5"></a><p class="title"><b>Example 22.14: Usage of assertEquals() with arrays</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">EqualsTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertEquals</span><span class="keyword">(</span><span class="keyword">array</span><span class="keyword">(</span><span class="string">'a'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'b'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'c'</span><span class="keyword">)</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><span class="string">'a'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'c'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'d'</span><span class="keyword">)</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit EqualsTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(EqualsTest)
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ -1,6 +1,6 @@
 Array
 (
     [0] =&gt; a
-    [1] =&gt; b
-    [2] =&gt; c
+    [1] =&gt; c
+    [2] =&gt; d
 )

/home/sb/EqualsTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertFalse()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertFalse"></a><code class="literal">assertFalse()</code></h3></div></div></div><a id="id2579802" class="indexterm"></a><p><code class="literal">assertFalse(bool $condition[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if <code class="literal">$condition</code> is <code class="literal">TRUE</code>.</p><div class="example"><a id="api.assert.assertFalse.example"></a><p class="title"><b>Example 22.15: Usage of assertFalse()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">FalseTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertFalse</span><span class="keyword">(</span><span class="default">TRUE</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit FalseTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(FalseTest)
Failed asserting that &lt;boolean:true&gt; is false.
/home/sb/FalseTest.php:11

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertFileEquals()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertFileEquals"></a><code class="literal">assertFileEquals()</code></h3></div></div></div><a id="id2579882" class="indexterm"></a><a id="id2579889" class="indexterm"></a><p><code class="literal">assertFileEquals(string $expected, string $actual[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code>  if the file specified by <code class="literal">$expected</code> does not have the same contents as the file specified by <code class="literal">$actual</code>.</p><p><code class="literal">assertFileNotEquals()</code> is the inverse of this assertion and takes the same arguments.</p><div class="example"><a id="api.assert.assertFileEquals.example"></a><p class="title"><b>Example 22.16: Usage of assertFileEquals()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">FileEqualsTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertFileEquals</span><span class="keyword">(</span><span class="string">'/home/sb/expected'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'/home/sb/actual'</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit FileEqualsTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(FileEqualsTest)
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ -1,2 +1,2 @@
-expected
+actual
 

/home/sb/FileEqualsTest.php:6

FAILURES!
Tests: 1, Assertions: 3, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertFileExists()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertFileExists"></a><code class="literal">assertFileExists()</code></h3></div></div></div><a id="id2579982" class="indexterm"></a><a id="id2579989" class="indexterm"></a><p><code class="literal">assertFileExists(string $filename[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the file specified by <code class="literal">$filename</code> does not exist.</p><p><code class="literal">assertFileNotExists()</code> is the inverse of this assertion and takes the same arguments.</p><div class="example"><a id="api.assert.assertFileExists.example"></a><p class="title"><b>Example 22.17: Usage of assertFileExists()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">FileExistsTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertFileExists</span><span class="keyword">(</span><span class="string">'/path/to/file'</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit FileExistsTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(FileExistsTest)
Failed asserting that file "/path/to/file" exists.
/home/sb/FileExistsTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertGreaterThan()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertGreaterThan"></a><code class="literal">assertGreaterThan()</code></h3></div></div></div><a id="id2580073" class="indexterm"></a><a id="id2580080" class="indexterm"></a><p><code class="literal">assertGreaterThan(mixed $expected, mixed $actual[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the value of <code class="literal">$actual</code> is not greater than the value of <code class="literal">$expected</code>.</p><p><code class="literal">assertAttributeGreaterThan()</code> is a convenience wrapper that uses a <code class="literal">public</code>, <code class="literal">protected</code>, or <code class="literal">private</code> attribute of a class or object as the actual value.</p><div class="example"><a id="api.assert.assertGreaterThan.example"></a><p class="title"><b>Example 22.18: Usage of assertGreaterThan()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">GreaterThanTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertGreaterThan</span><span class="keyword">(</span><span class="default">2</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit GreaterThanTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(GreaterThanTest)
Failed asserting that &lt;integer:1&gt; is greater than &lt;integer:2&gt;.
/home/sb/GreaterThanTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertGreaterThanOrEqual()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertGreaterThanOrEqual"></a><code class="literal">assertGreaterThanOrEqual()</code></h3></div></div></div><a id="id2580189" class="indexterm"></a><a id="id2580196" class="indexterm"></a><p><code class="literal">assertGreaterThanOrEqual(mixed $expected, mixed $actual[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the value of <code class="literal">$actual</code> is not greater than or equal to the value of <code class="literal">$expected</code>.</p><p><code class="literal">assertAttributeGreaterThanOrEqual()</code> is a convenience wrapper that uses a <code class="literal">public</code>, <code class="literal">protected</code>, or <code class="literal">private</code> attribute of a class or object as the actual value.</p><div class="example"><a id="api.assert.assertGreaterThanOrEqual.example"></a><p class="title"><b>Example 22.19: Usage of assertGreaterThanOrEqual()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">GreatThanOrEqualTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertGreaterThanOrEqual</span><span class="keyword">(</span><span class="default">2</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit GreaterThanOrEqualTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(GreatThanOrEqualTest)
Failed asserting that &lt;integer:1&gt; is equal to &lt;integer:2&gt; or is greater than &lt;integer:2&gt;.
/home/sb/GreaterThanOrEqualTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertLessThan()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertLessThan"></a><code class="literal">assertLessThan()</code></h3></div></div></div><a id="id2580307" class="indexterm"></a><a id="id2580314" class="indexterm"></a><p><code class="literal">assertLessThan(mixed $expected, mixed $actual[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the value of <code class="literal">$actual</code> is not less than the value of <code class="literal">$expected</code>.</p><p><code class="literal">assertAttributeLessThan()</code> is a convenience wrapper that uses a <code class="literal">public</code>, <code class="literal">protected</code>, or <code class="literal">private</code> attribute of a class or object as the actual value.</p><div class="example"><a id="api.assert.assertLessThan.example"></a><p class="title"><b>Example 22.20: Usage of assertLessThan()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">LessThanTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertLessThan</span><span class="keyword">(</span><span class="default">1</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">2</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit LessThanTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(LessThanTest)
Failed asserting that &lt;integer:2&gt; is less than &lt;integer:1&gt;.
/home/sb/LessThanTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertLessThanOrEqual()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertLessThanOrEqual"></a><code class="literal">assertLessThanOrEqual()</code></h3></div></div></div><a id="id2580423" class="indexterm"></a><a id="id2580430" class="indexterm"></a><p><code class="literal">assertLessThanOrEqual(mixed $expected, mixed $actual[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the value of <code class="literal">$actual</code> is not less than or equal to the value of <code class="literal">$expected</code>.</p><p><code class="literal">assertAttributeLessThanOrEqual()</code> is a convenience wrapper that uses a <code class="literal">public</code>, <code class="literal">protected</code>, or <code class="literal">private</code> attribute of a class or object as the actual value.</p><div class="example"><a id="api.assert.assertLessThanOrEqual.example"></a><p class="title"><b>Example 22.21: Usage of assertLessThanOrEqual()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">LessThanOrEqualTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertLessThanOrEqual</span><span class="keyword">(</span><span class="default">1</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">2</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit LessThanOrEqualTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(LessThanOrEqualTest)
Failed asserting that &lt;integer:2&gt; is equal to &lt;integer:1&gt; or is less than &lt;integer:1&gt;.
/home/sb/LessThanOrEqualTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertNotNull()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertNotNull"></a><code class="literal">assertNotNull()</code></h3></div></div></div><a id="id2580541" class="indexterm"></a><a id="id2580548" class="indexterm"></a><p><code class="literal">assertNotNull(mixed $variable[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if <code class="literal">$variable</code> is <code class="literal">NULL</code>.</p><p><code class="literal">assertNull()</code> is the inverse of this assertion and takes the same arguments.</p><div class="example"><a id="api.assert.assertNotNull.example"></a><p class="title"><b>Example 22.22: Usage of assertNotNull()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">NotNullTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertNotNull</span><span class="keyword">(</span><span class="default">NULL</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit NotNullTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(NotNullTest)
Failed asserting that &lt;null&gt; is not null.
/home/sb/NotNullTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertObjectHasAttribute()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertObjectHasAttribute"></a><code class="literal">assertObjectHasAttribute()</code></h3></div></div></div><a id="id2580637" class="indexterm"></a><a id="id2580644" class="indexterm"></a><p><code class="literal">assertObjectHasAttribute(string $attributeName, object $object[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if <code class="literal">$object-&gt;attributeName</code> does not exist.</p><p><code class="literal">assertObjectNotHasAttribute()</code> is the inverse of this assertion and takes the same arguments.</p><div class="example"><a id="api.assert.assertObjectHasAttribute.example"></a><p class="title"><b>Example 22.23: Usage of assertObjectHasAttribute()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">ObjectHasAttributeTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertObjectHasAttribute</span><span class="keyword">(</span><span class="string">'foo'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="keyword">new</span><span class="default">&nbsp;</span><span class="default">stdClass</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit ObjectHasAttributeTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(ObjectHasAttributeTest)
Failed asserting that object of class "stdClass" has attribute "foo".
/home/sb/ObjectHasAttributeTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertRegExp()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertRegExp"></a><code class="literal">assertRegExp()</code></h3></div></div></div><a id="id2580730" class="indexterm"></a><a id="id2580737" class="indexterm"></a><p><code class="literal">assertRegExp(string $pattern, string $string[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if <code class="literal">$string</code> does not match the regular expression <code class="literal">$pattern</code>.</p><p><code class="literal">assertNotRegExp()</code> is the inverse of this assertion and takes the same arguments.</p><div class="example"><a id="api.assert.assertRegExp.example"></a><p class="title"><b>Example 22.24: Usage of assertRegExp()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">RegExpTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertRegExp</span><span class="keyword">(</span><span class="string">'/foo/'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'bar'</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit RegExpTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(RegExpTest)
Failed asserting that &lt;string:bar&gt; matches PCRE pattern "/foo/".
/home/sb/RegExpTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertSame()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertSame"></a><code class="literal">assertSame()</code></h3></div></div></div><a id="id2580827" class="indexterm"></a><a id="id2580834" class="indexterm"></a><a id="id2580841" class="indexterm"></a><a id="id2580848" class="indexterm"></a><p><code class="literal">assertSame(mixed $expected, mixed $actual[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the two variables <code class="literal">$expected</code> and <code class="literal">$actual</code> do not have the same type and value.</p><p><code class="literal">assertNotSame()</code> is the inverse of this assertion and takes the same arguments.</p><p><code class="literal">assertAttributeSame()</code> and <code class="literal">assertAttributeNotSame()</code> are convenience wrappers that use a <code class="literal">public</code>, <code class="literal">protected</code>, or <code class="literal">private</code> attribute of a class or object as the actual value.</p><div class="example"><a id="api.assert.assertSame.example"></a><p class="title"><b>Example 22.25: Usage of assertSame()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">SameTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertSame</span><span class="keyword">(</span><span class="string">'2204'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">2204</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit SameTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(SameTest)
&lt;integer:2204&gt; does not match expected type "string".
/home/sb/SameTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br><p><code class="literal">assertSame(object $expected, object $actual[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the two variables <code class="literal">$expected</code> and <code class="literal">$actual</code> do not reference the same object.</p><div class="example"><a id="api.assert.assertSame.example2"></a><p class="title"><b>Example 22.26: Usage of assertSame() with objects</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">SameTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertSame</span><span class="keyword">(</span><span class="keyword">new</span><span class="default">&nbsp;</span><span class="default">stdClass</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="keyword">new</span><span class="default">&nbsp;</span><span class="default">stdClass</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit SameTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(SameTest)
Failed asserting that two variables reference the same object.
/home/sb/SameTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertSelectCount()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertSelectCount"></a><code class="literal">assertSelectCount()</code></h3></div></div></div><a id="id2581032" class="indexterm"></a><p><code class="literal">assertSelectCount(array $selector, integer $count, mixed $actual[, string $message = '', boolean $isHtml = TRUE])</code></p><p>XXX</p><div class="example"><a id="api.assert.assertSelectCount.example"></a><p class="title"><b>Example 22.27: Usage of assertSelectCount()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit SelectCountTest</code></strong>
</pre></div></div><br class="example-break"></br></div><div class="section" title="assertSelectEquals()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertSelectEquals"></a><code class="literal">assertSelectEquals()</code></h3></div></div></div><a id="id2581089" class="indexterm"></a><p><code class="literal">assertSelectEquals(array $selector, string $content, integer $count, mixed $actual[, string $message = '', boolean $isHtml = TRUE])</code></p><p>XXX</p><div class="example"><a id="api.assert.assertSelectEquals.example"></a><p class="title"><b>Example 22.28: Usage of assertSelectEquals()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit SelectEqualsTest</code></strong>
</pre></div></div><br class="example-break"></br></div><div class="section" title="assertSelectRegExp()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertSelectRegExp"></a><code class="literal">assertSelectRegExp()</code></h3></div></div></div><a id="id2581147" class="indexterm"></a><p><code class="literal">assertSelectRegExp(array $selector, string $pattern, integer $count, mixed $actual[, string $message = '', boolean $isHtml = TRUE])</code></p><p>XXX</p><div class="example"><a id="api.assert.assertSelectRegExp.example"></a><p class="title"><b>Example 22.29: Usage of assertSelectRegExp()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit SelectRegExpTest</code></strong>
</pre></div></div><br class="example-break"></br></div><div class="section" title="assertStringEqualsFile()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertStringEqualsFile"></a><code class="literal">assertStringEqualsFile()</code></h3></div></div></div><a id="id2581206" class="indexterm"></a><a id="id2581213" class="indexterm"></a><p><code class="literal">assertStringEqualsFile(string $expectedFile, string $actualString[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code>  if the file specified by <code class="literal">$expectedFile</code> does not have <code class="literal">$actualString</code> as its contents.</p><p><code class="literal">assertStringNotEqualsFile()</code> is the inverse of this assertion and takes the same arguments.</p><div class="example"><a id="api.assert.assertStringEqualsFile.example"></a><p class="title"><b>Example 22.30: Usage of assertStringEqualsFile()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">StringEqualsFileTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertStringEqualsFile</span><span class="keyword">(</span><span class="string">'/home/sb/expected'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'actual'</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit StringEqualsFileTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(StringEqualsFileTest)
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ -1,2 +1 @@
-expected
-
+actual
\ No newline at end of file

/home/sb/StringEqualsFileTest.php:6

FAILURES!
Tests: 1, Assertions: 2, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertTag()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertTag"></a><code class="literal">assertTag()</code></h3></div></div></div><a id="id2581306" class="indexterm"></a><a id="id2581312" class="indexterm"></a><p><code class="literal">assertTag(array $matcher, string $actual[, string $message = '', boolean $isHtml = TRUE])</code></p><p>Reports an error identified by <code class="literal">$message</code> if <code class="literal">$actual</code> is not matched by the <code class="literal">$matcher</code>.</p><p><code class="literal">$matcher</code> is an associative array that specifies the match criteria for the assertion:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><code class="literal">id</code>: The node with the given <code class="literal">id</code> attribute must match the corresponsing value.</li><li class="listitem"><code class="literal">tags</code>: The node type must match the corresponding value.</li><li class="listitem"><code class="literal">attributes</code>: The node's attributes must match the corresponsing values in the <code class="literal">$attributes</code> associative array.</li><li class="listitem"><code class="literal">content</code>: The text content must match the given value.</li><li class="listitem"><code class="literal">parent</code>: The node's parent must match the <code class="literal">$parent</code> associative array.</li><li class="listitem"><code class="literal">child</code>: At least one of the node's immediate children must meet the criteria described by the <code class="literal">$child</code> associative array.</li><li class="listitem"><code class="literal">ancestor</code>: At least one of the node's ancestors must meet the criteria described by the <code class="literal">$ancestor</code> associative array.</li><li class="listitem"><code class="literal">descendant</code>: At least one of the node's descendants must meet the criteria described by the <code class="literal">$descendant</code> associative array.</li><li class="listitem"><code class="literal">children</code>: Associative array for counting children of a node.
          <div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><code class="literal">count</code>: The number of matching children must be equal to this number.</li><li class="listitem"><code class="literal">less_than</code>: The number of matching children must be less than this number.</li><li class="listitem"><code class="literal">greater_than</code>: The number of matching children must be greater than this number.</li><li class="listitem"><code class="literal">only</code>: Another associative array consisting of the keys to use to match on the children, and only matching children will be counted.</li></ul></div></li></ul></div><p><code class="literal">assertNotTag()</code> is the inverse of this assertion and takes the same arguments.</p><div class="example"><a id="api.assert.assertTag.example"></a><p class="title"><b>Example 22.31: Usage of assertTag()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="comment">//&nbsp;Matcher&nbsp;that&nbsp;asserts&nbsp;that&nbsp;there&nbsp;is&nbsp;an&nbsp;element&nbsp;with&nbsp;an&nbsp;id=&quot;my_id&quot;.</span><br /><span class="default">$matcher</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><span class="string">'id'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'my_id'</span><span class="keyword">)</span><span class="keyword">;</span><br />&nbsp;<br /><span class="comment">//&nbsp;Matcher&nbsp;that&nbsp;asserts&nbsp;that&nbsp;there&nbsp;is&nbsp;a&nbsp;&quot;span&quot;&nbsp;tag.</span><br /><span class="default">$matcher</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><span class="string">'tag'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'span'</span><span class="keyword">)</span><span class="keyword">;</span><br />&nbsp;<br /><span class="comment">//&nbsp;Matcher&nbsp;that&nbsp;asserts&nbsp;that&nbsp;there&nbsp;is&nbsp;a&nbsp;&quot;span&quot;&nbsp;tag&nbsp;with&nbsp;the&nbsp;content</span><br /><span class="comment">//&nbsp;&quot;Hello&nbsp;World&quot;.</span><br /><span class="default">$matcher</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><span class="string">'tag'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'span'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'content'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'Hello&nbsp;World'</span><span class="keyword">)</span><span class="keyword">;</span><br />&nbsp;<br /><span class="comment">//&nbsp;Matcher&nbsp;that&nbsp;asserts&nbsp;that&nbsp;there&nbsp;is&nbsp;a&nbsp;&quot;span&quot;&nbsp;tag&nbsp;with&nbsp;content&nbsp;matching&nbsp;the</span><br /><span class="comment">//&nbsp;regular&nbsp;expression&nbsp;pattern.</span><br /><span class="default">$matcher</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><span class="string">'tag'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'span'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'content'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'/Try&nbsp;P(HP|ython)/'</span><span class="keyword">)</span><span class="keyword">;</span><br />&nbsp;<br /><span class="comment">//&nbsp;Matcher&nbsp;that&nbsp;asserts&nbsp;that&nbsp;there&nbsp;is&nbsp;a&nbsp;&quot;span&quot;&nbsp;with&nbsp;an&nbsp;&quot;list&quot;&nbsp;class&nbsp;attribute.</span><br /><span class="default">$matcher</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><br /><span class="default">&nbsp;&nbsp;</span><span class="string">'tag'</span><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'span'</span><span class="keyword">,</span><br /><span class="default">&nbsp;&nbsp;</span><span class="string">'attributes'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><span class="string">'class'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'list'</span><span class="keyword">)</span><br /><span class="keyword">)</span><span class="keyword">;</span><br />&nbsp;<br /><span class="comment">//&nbsp;Matcher&nbsp;that&nbsp;asserts&nbsp;that&nbsp;there&nbsp;is&nbsp;a&nbsp;&quot;span&quot;&nbsp;inside&nbsp;of&nbsp;a&nbsp;&quot;div&quot;.</span><br /><span class="default">$matcher</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><br /><span class="default">&nbsp;&nbsp;</span><span class="string">'tag'</span><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'span'</span><span class="keyword">,</span><br /><span class="default">&nbsp;&nbsp;</span><span class="string">'parent'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><span class="string">'tag'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'div'</span><span class="keyword">)</span><br /><span class="keyword">)</span><span class="keyword">;</span><br />&nbsp;<br /><span class="comment">//&nbsp;Matcher&nbsp;that&nbsp;asserts&nbsp;that&nbsp;there&nbsp;is&nbsp;a&nbsp;&quot;span&quot;&nbsp;somewhere&nbsp;inside&nbsp;a&nbsp;&quot;table&quot;.</span><br /><span class="default">$matcher</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><br /><span class="default">&nbsp;&nbsp;</span><span class="string">'tag'</span><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'span'</span><span class="keyword">,</span><br /><span class="default">&nbsp;&nbsp;</span><span class="string">'ancestor'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><span class="string">'tag'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'table'</span><span class="keyword">)</span><br /><span class="keyword">)</span><span class="keyword">;</span><br />&nbsp;<br /><span class="comment">//&nbsp;Matcher&nbsp;that&nbsp;asserts&nbsp;that&nbsp;there&nbsp;is&nbsp;a&nbsp;&quot;span&quot;&nbsp;with&nbsp;at&nbsp;least&nbsp;one&nbsp;&quot;em&quot;&nbsp;child.</span><br /><span class="default">$matcher</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><br /><span class="default">&nbsp;&nbsp;</span><span class="string">'tag'</span><span class="default">&nbsp;&nbsp;&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'span'</span><span class="keyword">,</span><br /><span class="default">&nbsp;&nbsp;</span><span class="string">'child'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><span class="string">'tag'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'em'</span><span class="keyword">)</span><br /><span class="keyword">)</span><span class="keyword">;</span><br />&nbsp;<br /><span class="comment">//&nbsp;Matcher&nbsp;that&nbsp;asserts&nbsp;that&nbsp;there&nbsp;is&nbsp;a&nbsp;&quot;span&quot;&nbsp;containing&nbsp;a&nbsp;(possibly&nbsp;nested)</span><br /><span class="comment">//&nbsp;&quot;strong&quot;&nbsp;tag.</span><br /><span class="default">$matcher</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><br /><span class="default">&nbsp;&nbsp;</span><span class="string">'tag'</span><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'span'</span><span class="keyword">,</span><br /><span class="default">&nbsp;&nbsp;</span><span class="string">'descendant'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><span class="string">'tag'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'strong'</span><span class="keyword">)</span><br /><span class="keyword">)</span><span class="keyword">;</span><br />&nbsp;<br /><span class="comment">//&nbsp;Matcher&nbsp;that&nbsp;asserts&nbsp;that&nbsp;there&nbsp;is&nbsp;a&nbsp;&quot;span&quot;&nbsp;containing&nbsp;5-10&nbsp;&quot;em&quot;&nbsp;tags&nbsp;as</span><br /><span class="comment">//&nbsp;immediate&nbsp;children.</span><br /><span class="default">$matcher</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><br /><span class="default">&nbsp;&nbsp;</span><span class="string">'tag'</span><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'span'</span><span class="keyword">,</span><br /><span class="default">&nbsp;&nbsp;</span><span class="string">'children'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="string">'less_than'</span><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="default">11</span><span class="keyword">,</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="string">'greater_than'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="default">4</span><span class="keyword">,</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="string">'only'</span><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><span class="string">'tag'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'em'</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;</span><span class="keyword">)</span><br /><span class="keyword">)</span><span class="keyword">;</span><br />&nbsp;<br /><span class="comment">//&nbsp;Matcher&nbsp;that&nbsp;asserts&nbsp;that&nbsp;there&nbsp;is&nbsp;a&nbsp;&quot;div&quot;,&nbsp;with&nbsp;an&nbsp;&quot;ul&quot;&nbsp;ancestor&nbsp;and&nbsp;a&nbsp;&quot;li&quot;</span><br /><span class="comment">//&nbsp;parent&nbsp;(with&nbsp;class=&quot;enum&quot;),&nbsp;and&nbsp;containing&nbsp;a&nbsp;&quot;span&quot;&nbsp;descendant&nbsp;that&nbsp;contains</span><br /><span class="comment">//&nbsp;an&nbsp;element&nbsp;with&nbsp;id=&quot;my_test&quot;&nbsp;and&nbsp;the&nbsp;text&nbsp;&quot;Hello&nbsp;World&quot;.</span><br /><span class="default">$matcher</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><br /><span class="default">&nbsp;&nbsp;</span><span class="string">'tag'</span><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'div'</span><span class="keyword">,</span><br /><span class="default">&nbsp;&nbsp;</span><span class="string">'ancestor'</span><span class="default">&nbsp;&nbsp;&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><span class="string">'tag'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'ul'</span><span class="keyword">)</span><span class="keyword">,</span><br /><span class="default">&nbsp;&nbsp;</span><span class="string">'parent'</span><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="string">'tag'</span><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'li'</span><span class="keyword">,</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="string">'attributes'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><span class="string">'class'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'enum'</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;</span><span class="keyword">)</span><span class="keyword">,</span><br /><span class="default">&nbsp;&nbsp;</span><span class="string">'descendant'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="string">'tag'</span><span class="default">&nbsp;&nbsp;&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'span'</span><span class="keyword">,</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="string">'child'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="keyword">array</span><span class="keyword">(</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="string">'id'</span><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'my_test'</span><span class="keyword">,</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="string">'content'</span><span class="default">&nbsp;</span><span class="keyword">=&gt;</span><span class="default">&nbsp;</span><span class="string">'Hello&nbsp;World'</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;</span><span class="keyword">)</span><br /><span class="keyword">)</span><span class="keyword">;</span><br />&nbsp;<br /><span class="comment">//&nbsp;Use&nbsp;assertTag()&nbsp;to&nbsp;apply&nbsp;a&nbsp;$matcher&nbsp;to&nbsp;a&nbsp;piece&nbsp;of&nbsp;$html.</span><br /><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertTag</span><span class="keyword">(</span><span class="default">$matcher</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">$html</span><span class="keyword">)</span><span class="keyword">;</span><br />&nbsp;<br /><span class="comment">//&nbsp;Use&nbsp;assertTag()&nbsp;to&nbsp;apply&nbsp;a&nbsp;$matcher&nbsp;to&nbsp;a&nbsp;piece&nbsp;of&nbsp;$xml.</span><br /><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertTag</span><span class="keyword">(</span><span class="default">$matcher</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">$xml</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">''</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">FALSE</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">?&gt;</span><br /></code></pre></div></div><br class="example-break"></br></div><div class="section" title="assertThat()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertThat"></a><code class="literal">assertThat()</code></h3></div></div></div><a id="id2581558" class="indexterm"></a><p>
        More complex assertions can be formulated using the
        <code class="literal">PHPUnit_Framework_Constraint</code> classes. They can be
        evaluated using the <code class="literal">assertThat()</code> method.
        <a class="xref" href="api.html#api.assert.assertThat.example" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertThat.example" title="Example 22.32: Usage of assertThat()">Example 22.32</a> shows how the
        <code class="literal">logicalNot()</code> and <code class="literal">equalTo()</code>
        constraints can be used to express the same assertion as
        <code class="literal">assertNotEquals()</code>.
      </p><p><code class="literal">assertThat(mixed $value, PHPUnit_Framework_Constraint $constraint[, $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the <code class="literal">$value</code> does not match the <code class="literal">$constraint</code>.</p><div class="example"><a id="api.assert.assertThat.example"></a><p class="title"><b>Example 22.32: Usage of assertThat()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">BiscuitTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testEquals</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$theBiscuit</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">new</span><span class="default">&nbsp;</span><span class="default">Biscuit</span><span class="keyword">(</span><span class="string">'Ginger'</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$myBiscuit</span><span class="default">&nbsp;&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">new</span><span class="default">&nbsp;</span><span class="default">Biscuit</span><span class="keyword">(</span><span class="string">'Ginger'</span><span class="keyword">)</span><span class="keyword">;</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertThat</span><span class="keyword">(</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$theBiscuit</span><span class="keyword">,</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">logicalNot</span><span class="keyword">(</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">equalTo</span><span class="keyword">(</span><span class="default">$myBiscuit</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre></div></div><br class="example-break"></br><p>
        <a class="xref" href="api.html#api.assert.assertThat.tables.constraints" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertThat.tables.constraints" title="Table 22.1. Constraints">Table 22.1</a> shows the
        available <code class="literal">PHPUnit_Framework_Constraint</code> classes.
      </p><div class="table"><a id="api.assert.assertThat.tables.constraints"></a><p class="title"><b>Table 22.1. Constraints</b></p><div class="table-contents"><table summary="Constraints" border="1"><colgroup><col></col><col></col></colgroup><thead><tr><th align="left">Constraint</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_Attribute attribute(PHPUnit_Framework_Constraint $constraint, $attributeName)</code></td><td align="left">Constraint that applies another constraint to an attribute of a class or an object.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_IsAnything anything()</code></td><td align="left">Constraint that accepts any input value.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_ArrayHasKey arrayHasKey(mixed $key)</code></td><td align="left">Constraint that asserts that the array it is evaluated for has a given key.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_TraversableContains contains(mixed $value)</code></td><td align="left">Constraint that asserts that the <code class="literal">array</code> or object that implements the <code class="literal">Iterator</code> interface it is evaluated for contains a given value.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_IsEqual equalTo($value, $delta = 0, $maxDepth = 10)</code></td><td align="left">Constraint that checks if one value is equal to another.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_Attribute attributeEqualTo($attributeName, $value, $delta = 0, $maxDepth = 10)</code></td><td align="left">Constraint that checks if a value is equal to an attribute of a class or of an object.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_FileExists fileExists()</code></td><td align="left">Constraint that checks if the file(name) that it is evaluated for exists.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_GreaterThan greaterThan(mixed $value)</code></td><td align="left">Constraint that asserts that the value it is evaluated for is greater than a given value.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_Or greaterThanOrEqual(mixed $value)</code></td><td align="left">Constraint that asserts that the value it is evaluated for is greater than or equal to a given value.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_ClassHasAttribute classHasAttribute(string $attributeName)</code></td><td align="left">Constraint that asserts that the class it is evaluated for has a given attribute.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_ClassHasStaticAttribute classHasStaticAttribute(string $attributeName)</code></td><td align="left">Constraint that asserts that the class it is evaluated for has a given static attribute.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_ObjectHasAttribute hasAttribute(string $attributeName)</code></td><td align="left">Constraint that asserts that the object it is evaluated for has a given attribute.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_IsIdentical identicalTo(mixed $value)</code></td><td align="left">Constraint that asserts that one value is identical to another.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_IsFalse isFalse()</code></td><td align="left">Constraint that asserts that the value it is evaluated is <code class="literal">FALSE</code>.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_IsInstanceOf isInstanceOf(string $className)</code></td><td align="left">Constraint that asserts that the object it is evaluated for is an instance of a given class.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_IsNull isNull()</code></td><td align="left">Constraint that asserts that the value it is evaluated is <code class="literal">NULL</code>.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_IsTrue isTrue()</code></td><td align="left">Constraint that asserts that the value it is evaluated is <code class="literal">TRUE</code>.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_IsType isType(string $type)</code></td><td align="left">Constraint that asserts that the value it is evaluated for is of a specified type.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_LessThan lessThan(mixed $value)</code></td><td align="left">Constraint that asserts that the value it is evaluated for is smaller than a given value.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_Or lessThanOrEqual(mixed $value)</code></td><td align="left">Constraint that asserts that the value it is evaluated for is smaller than or equal to a given value.</td></tr><tr><td align="left"><code class="literal">logicalAnd()</code></td><td align="left">Logical AND.</td></tr><tr><td align="left"><code class="literal">logicalNot(PHPUnit_Framework_Constraint $constraint)</code></td><td align="left">Logical NOT.</td></tr><tr><td align="left"><code class="literal">logicalOr()</code></td><td align="left">Logical OR.</td></tr><tr><td align="left"><code class="literal">logicalXor()</code></td><td align="left">Logical XOR.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_PCREMatch matchesRegularExpression(string $pattern)</code></td><td align="left">Constraint that asserts that the string it is evaluated for matches a regular expression.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Constraint_StringContains stringContains(string $string, bool $case)</code></td><td align="left">Constraint that asserts that the string it is evaluated for contains a given string.</td></tr></tbody></table></div></div><br class="table-break"></br></div><div class="section" title="assertTrue()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertTrue"></a><code class="literal">assertTrue()</code></h3></div></div></div><a id="id2582378" class="indexterm"></a><p><code class="literal">assertTrue(bool $condition[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if <code class="literal">$condition</code> is <code class="literal">FALSE</code>.</p><div class="example"><a id="api.assert.assertTrue.example"></a><p class="title"><b>Example 22.33: Usage of assertTrue()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">TrueTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertTrue</span><span class="keyword">(</span><span class="default">FALSE</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit TrueTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(TrueTest)
Failed asserting that &lt;boolean:false&gt; is true.
/home/sb/TrueTest.php:11

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertType()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertType"></a><code class="literal">assertType()</code></h3></div></div></div><a id="id2582458" class="indexterm"></a><a id="id2582465" class="indexterm"></a><p><code class="literal">assertType(string $expected, mixed $actual[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the variable <code class="literal">$actual</code> is not of type <code class="literal">$expected</code>.</p><p><code class="literal">$expected</code> can be one of these constants:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><code class="literal">PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY</code> (<code class="literal">"array"</code>)</li><li class="listitem"><code class="literal">PHPUnit_Framework_Constraint_IsType::TYPE_BOOL</code> (<code class="literal">"bool"</code>)</li><li class="listitem"><code class="literal">PHPUnit_Framework_Constraint_IsType::TYPE_FLOAT</code> (<code class="literal">"float"</code>)</li><li class="listitem"><code class="literal">PHPUnit_Framework_Constraint_IsType::TYPE_INT</code> (<code class="literal">"int"</code>)</li><li class="listitem"><code class="literal">PHPUnit_Framework_Constraint_IsType::TYPE_NULL</code> (<code class="literal">"null"</code>)</li><li class="listitem"><code class="literal">PHPUnit_Framework_Constraint_IsType::TYPE_NUMERIC</code> (<code class="literal">"numeric"</code>)</li><li class="listitem"><code class="literal">PHPUnit_Framework_Constraint_IsType::TYPE_OBJECT</code> (<code class="literal">"object"</code>)</li><li class="listitem"><code class="literal">PHPUnit_Framework_Constraint_IsType::TYPE_RESOURCE</code> (<code class="literal">"resource"</code>)</li><li class="listitem"><code class="literal">PHPUnit_Framework_Constraint_IsType::TYPE_STRING</code> (<code class="literal">"string"</code>)</li></ul></div><p><code class="literal">assertNotType()</code> is the inverse of this assertion and takes the same arguments.</p><div class="example"><a id="api.assert.assertType.example"></a><p class="title"><b>Example 22.34: Usage of assertType()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">TypeTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertType</span><span class="keyword">(</span><span class="default">PHPUnit_Framework_Constraint_IsType</span><span class="keyword">::</span><span class="default">TYPE_STRING</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">2204</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure2</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertType</span><span class="keyword">(</span><span class="string">'string'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">2204</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure3</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertType</span><span class="keyword">(</span><span class="string">'Exception'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="keyword">new</span><span class="default">&nbsp;</span><span class="default">stdClass</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit TypeTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

FFF

Time: 0 seconds

There were 3 failures:

1) testFailure(TypeTest)
Failed asserting that &lt;integer:2204&gt; is of type "string".
/home/sb/TypeTest.php:6

2) testFailure2(TypeTest)
Failed asserting that &lt;integer:2204&gt; is of type "string".
/home/sb/TypeTest.php:11

3) testFailure3(TypeTest)
Failed asserting that &lt;stdClass&gt; is an instance of class "Exception".
/home/sb/TypeTest.php:16

FAILURES!
Tests: 3, Assertions: 3, Failures: 3.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertXmlFileEqualsXmlFile()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertXmlFileEqualsXmlFile"></a><code class="literal">assertXmlFileEqualsXmlFile()</code></h3></div></div></div><a id="id2582704" class="indexterm"></a><a id="id2582710" class="indexterm"></a><p><code class="literal">assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the XML document in <code class="literal">$actualFile</code> is not equal to the XML document in <code class="literal">$expectedFile</code>.</p><p><code class="literal">assertXmlFileNotEqualsXmlFile()</code> is the inverse of this assertion and takes the same arguments.</p><div class="example"><a id="api.assert.assertXmlFileEqualsXmlFile.example"></a><p class="title"><b>Example 22.35: Usage of assertXmlFileEqualsXmlFile()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">XmlFileEqualsXmlFileTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertXmlFileEqualsXmlFile</span><span class="keyword">(</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="string">'/home/sb/expected.xml'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'/home/sb/actual.xml'</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit XmlFileEqualsXmlFileTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(XmlFileEqualsXmlFileTest)
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ -1,4 +1,4 @@
 &lt;?xml version="1.0"?&gt;
 &lt;foo&gt;
-  &lt;bar/&gt;
+  &lt;baz/&gt;
 &lt;/foo&gt;

/home/sb/XmlFileEqualsXmlFileTest.php:7

FAILURES!
Tests: 1, Assertions: 3, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertXmlStringEqualsXmlFile()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertXmlStringEqualsXmlFile"></a><code class="literal">assertXmlStringEqualsXmlFile()</code></h3></div></div></div><a id="id2582806" class="indexterm"></a><a id="id2582813" class="indexterm"></a><p><code class="literal">assertXmlStringEqualsXmlFile(string $expectedFile, string $actualXml[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the XML document in <code class="literal">$actualXml</code> is not equal to the XML document in <code class="literal">$expectedFile</code>.</p><p><code class="literal">assertXmlStringNotEqualsXmlFile()</code> is the inverse of this assertion and takes the same arguments.</p><div class="example"><a id="api.assert.assertXmlStringEqualsXmlFile.example"></a><p class="title"><b>Example 22.36: Usage of assertXmlStringEqualsXmlFile()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">XmlStringEqualsXmlFileTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertXmlStringEqualsXmlFile</span><span class="keyword">(</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="string">'/home/sb/expected.xml'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'&lt;foo&gt;&lt;baz/&gt;&lt;/foo&gt;'</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit XmlStringEqualsXmlFileTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(XmlStringEqualsXmlFileTest)
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ -1,4 +1,4 @@
 &lt;?xml version="1.0"?&gt;
 &lt;foo&gt;
-  &lt;bar/&gt;
+  &lt;baz/&gt;
 &lt;/foo&gt;

/home/sb/XmlStringEqualsXmlFileTest.php:7

FAILURES!
Tests: 1, Assertions: 2, Failures: 1.</pre></div></div><br class="example-break"></br></div><div class="section" title="assertXmlStringEqualsXmlString()"><div class="titlepage"><div><div><h3 class="title"><a id="api.assert.assertXmlStringEqualsXmlString"></a><code class="literal">assertXmlStringEqualsXmlString()</code></h3></div></div></div><a id="id2582910" class="indexterm"></a><a id="id2582917" class="indexterm"></a><p><code class="literal">assertXmlStringEqualsXmlString(string $expectedXml, string $actualXml[, string $message = ''])</code></p><p>Reports an error identified by <code class="literal">$message</code> if the XML document in <code class="literal">$actualXml</code> is not equal to the XML document in <code class="literal">$expectedXml</code>.</p><p><code class="literal">assertXmlStringNotEqualsXmlString()</code> is the inverse of this assertion and takes the same arguments.</p><div class="example"><a id="api.assert.assertXmlStringEqualsXmlString.example"></a><p class="title"><b>Example 22.37: Usage of assertXmlStringEqualsXmlString()</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">XmlStringEqualsXmlStringTest</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">testFailure</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertXmlStringEqualsXmlString</span><span class="keyword">(</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="string">'&lt;foo&gt;&lt;bar/&gt;&lt;/foo&gt;'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="string">'&lt;foo&gt;&lt;baz/&gt;&lt;/foo&gt;'</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit XmlStringEqualsXmlStringTest</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

F

Time: 0 seconds

There was 1 failure:

1) testFailure(XmlStringEqualsXmlStringTest)
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ -1,4 +1,4 @@
 &lt;?xml version="1.0"?&gt;
 &lt;foo&gt;
-  &lt;bar/&gt;
+  &lt;baz/&gt;
 &lt;/foo&gt;

/home/sb/XmlStringEqualsXmlStringTest.php:7

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.</pre></div></div><br class="example-break"></br></div><p>
      You may find that you need other assertions than these to compare
      objects specific to your project. Create your own <code class="literal">Assert</code>
      class to contain these assertions to simplify your tests.
    </p><p>
      Failing assertions all call a single bottleneck method,
      <code class="literal">fail(string $message)</code>, which throws an
      <code class="literal">PHPUnit_Framework_AssertionFailedError</code>. There is
      also a variant which takes no parameters. Call <code class="literal">fail()</code>
      explicitly when your test encounters an error. The test for an expected
      exception is an example.
      <a class="xref" href="api.html#api.assert.tables.bottleneck-methods" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.tables.bottleneck-methods" title="Table 22.2. Bottleneck Methods">Table 22.2</a> lists the
      bottlenext methods in PHPUnit.
    </p><div class="table"><a id="api.assert.tables.bottleneck-methods"></a><p class="title"><b>Table 22.2. Bottleneck Methods</b></p><div class="table-contents"><table summary="Bottleneck Methods" border="1"><colgroup><col></col><col></col></colgroup><thead><tr><th align="left">Method</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"><code class="literal">void fail()</code></td><td align="left">Reports an error.</td></tr><tr><td align="left"><code class="literal">void fail(string $message)</code></td><td align="left">Reports an error identified by <code class="literal">$message</code>.</td></tr></tbody></table></div></div><br class="table-break"></br><p>
      <a id="id2583128" class="indexterm"></a>
      <a id="id2583134" class="indexterm"></a>

      <code class="literal">markTestIncomplete()</code> and <code class="literal">markTestSkipped()</code>
      are convenience methods for marking a test as being incomplete or skipped.
    </p><div class="table"><a id="api.assert.tables.incomplete-skipped"></a><p class="title"><b>Table 22.3. Marking a test as being incomplete or skipped</b></p><div class="table-contents"><table summary="Marking a test as being incomplete or skipped" border="1"><colgroup><col></col><col></col></colgroup><thead><tr><th align="left">Method</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"><code class="literal">void markTestIncomplete(string $message)</code></td><td align="left">Marks the current test as being incomplete, <code class="literal">$message</code> is optional.</td></tr><tr><td align="left"><code class="literal">void markTestSkipped(string $message)</code></td><td align="left">Marks the current test as being skipped, <code class="literal">$message</code> is optional.</td></tr></tbody></table></div></div><br class="table-break"></br><p>
      Although unit tests are about testing the public interface of a class, you
      may sometimes want to test the values of non-public attributes. The
      <code class="literal">readAttribute()</code> method enables you to do this and
      returns the value of a given (static) attribute from a given class or
      object.
    </p><div class="table"><a id="api.assert.tables.readAttribute"></a><p class="title"><b>Table 22.4. Accessing non-public attributes</b></p><div class="table-contents"><table summary="Accessing non-public attributes" border="1"><colgroup><col></col><col></col></colgroup><thead><tr><th align="left">Method</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"><code class="literal">Mixed readAttribute($classOrObject, $attributeName)</code></td><td align="left">Returns the value of a given (static) attribute (<code class="literal">$attributeName</code>) of a class or of an object. This also works for attributes that are declared <code class="literal">protected</code> or <code class="literal">private</code>.</td></tr></tbody></table></div></div><br class="table-break"></br></div><div class="section" title="PHPUnit_Framework_Test"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="api.test"></a>PHPUnit_Framework_Test</h2></div></div></div><a id="id2583357" class="indexterm"></a><p>
      <code class="literal">PHPUnit_Framework_Test</code> is the generic interface
      used by all objects that can act as tests. Implementors may represent
      one or more tests. The two methods are shown in
      <a class="xref" href="api.html#api.test.tables.implementor-methods" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.test.tables.implementor-methods" title="Table 22.5. Implementor Methods">Table 22.5</a>.
    </p><div class="table"><a id="api.test.tables.implementor-methods"></a><p class="title"><b>Table 22.5. Implementor Methods</b></p><div class="table-contents"><table summary="Implementor Methods" border="1"><colgroup><col></col><col></col></colgroup><thead><tr><th align="left">Method</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"><code class="literal">int count()</code></td><td align="left">Return the number of tests.</td></tr><tr><td align="left"><code class="literal">void run(PHPUnit_Framework_TestResult $result)</code></td><td align="left">Run the tests and report the results on <code class="literal">$result</code>.</td></tr></tbody></table></div></div><br class="table-break"></br><p>
      <code class="literal">PHPUnit_Framework_TestCase</code> and
      <code class="literal">PHPUnit_Framework_TestSuite</code> are the two most
      prominent implementors of <code class="literal">PHPUnit_Framework_Test</code>.
      You can implement <code class="literal">PHPUnit_Framework_Test</code> yourself.
      The interface is kept small intentionally so it will be easy to
      implement.
    </p></div><div class="section" title="PHPUnit_Framework_TestCase"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="api.testcase"></a>PHPUnit_Framework_TestCase</h2></div></div></div><a id="id2583499" class="indexterm"></a><p>
      Your test case classes will inherit from
      <code class="literal">PHPUnit_Framework_TestCase</code>. Most of the time, you
      will run tests from automatically created test suites. In this case,
      each of your tests should be represented by a method named
      <code class="literal">test*</code> (by convention).
    </p><p>
      <code class="literal">PHPUnit_Framework_TestCase</code> implements
      <code class="literal">PHPUnit_Framework_Test::count()</code> so that it
      always returns <code class="literal">1</code>. The implementation of
      <code class="literal">PHPUnit_Framework_Test::run(PHPUnit_Framework_TestResult $result)</code>
      in this class runs <code class="literal">setUp()</code>, runs the test method,
      and then runs <code class="literal">tearDown()</code>, reporting any exceptions
      to the <code class="literal">PHPUnit_Framework_TestResult</code>.
    </p><p>
      <a class="xref" href="api.html#api.testcase.tables.api" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.testcase.tables.api" title="Table 22.6. TestCase">Table 22.6</a> shows the
      methods provided by <code class="literal">PHPUnit_Framework_TestCase</code>.
    </p><div class="table"><a id="api.testcase.tables.api"></a><p class="title"><b>Table 22.6. TestCase</b></p><div class="table-contents"><table summary="TestCase" border="1"><colgroup><col></col><col></col></colgroup><thead><tr><th align="left">Method</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"><code class="literal">__construct()</code></td><td align="left">Creates a test case.</td></tr><tr><td align="left"><code class="literal">__construct(string $name)</code></td><td align="left">Creates a named test case. Names are used to print the test case and often as the name of the test method to be run by reflection.</td></tr><tr><td align="left"><code class="literal">string getName()</code></td><td align="left">Return the name of the test case.</td></tr><tr><td align="left"><code class="literal">void setName($name)</code></td><td align="left">Set the name of the test case.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_TestResult run(PHPUnit_Framework_TestResult $result)</code></td><td align="left">Convenience method to run the test case and report it in <code class="literal">$result</code>.</td></tr><tr><td align="left"><code class="literal">void runTest()</code></td><td align="left">Override with a testing method if you do not want the testing method to be invoked by reflection.</td></tr><tr><td align="left"><code class="literal">object getMock($className, [array $methods, [array $arguments, [string $mockClassName, [boolean $callOriginalConstructor, [boolean $callOriginalClone, [boolean $callAutoload]]]]]])</code></td><td align="left">Returns a mock object (see <a class="xref" href="test-doubles.html" tppabs="http://www.phpunit.de/manual/current/en/test-doubles.html" title="Chapter 11. Test Doubles">Chapter 11</a>) for the specified <code class="literal">$className</code>. By default, all methods of the given class are mocked. When the second (optional) parameter is provided, only the methods whose names are in the array are mocked. The third (optional) parameter may hold a parameter array that is passed to the mock object's constructor. The fourth (optional) parameter can be used to specify a class name for the mock object. The fifth (optional) parameter can be used to disable the call to the original object's <code class="literal">__construct()</code> method. The sixth (optional) parameter can be used to disable the call to the original object's <code class="literal">__clone()</code> method. The seventh (optional) parameter can be used to disable <code class="literal">__autoload()</code> during mock object creation.</td></tr><tr><td align="left"><code class="literal">void iniSet(string $varName, mixed $newValue)</code></td><td align="left">This method is a wrapper for the <a class="ulink" href="javascript:if(confirm('http://www.php.net/ini_set  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.php.net/ini_set'" tppabs="http://www.php.net/ini_set" target="_top"><code class="literal">ini_set()</code></a> function that automatically resets the modified <code class="filename">php.ini</code> setting to its original value after the test is run.</td></tr><tr><td align="left"><code class="literal">void setLocale(integer $category, string $locale, ...)</code></td><td align="left">This method is a wrapper for the <a class="ulink" href="javascript:if(confirm('http://www.php.net/setlocale  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.php.net/setlocale'" tppabs="http://www.php.net/setlocale" target="_top"><code class="literal">setlocale()</code></a> function that automatically resets the locale to its original value after the test is run.</td></tr></tbody></table></div></div><br class="table-break"></br><p>
      There are two template methods -- <code class="literal">setUp()</code> and
      <code class="literal">tearDown()</code> -- you can override to create and
      dispose of the objects against which you are going to test.
      <a class="xref" href="api.html#api.testcase.tables.template-methods" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.testcase.tables.template-methods" title="Table 22.7. Template Methods">Table 22.7</a> shows
      these methods. The template methods <code class="literal">assertPreConditions()</code>
      and <code class="literal">assertPostConditions()</code> can be used to define
      assertions that should be performed by all tests of a test case class.
    </p><div class="table"><a id="api.testcase.tables.template-methods"></a><p class="title"><b>Table 22.7. Template Methods</b></p><div class="table-contents"><table summary="Template Methods" border="1"><colgroup><col></col><col></col></colgroup><thead><tr><th align="left">Method</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"><code class="literal">void setUp()</code></td><td align="left">Override to set up the fixture, for example create an object graph.</td></tr><tr><td align="left"><code class="literal">void assertPreConditions()</code></td><td align="left">Override to perform assertions shared by all tests of a test case class. This method is called before the execution of a test starts and after setUp() is called.</td></tr><tr><td align="left"><code class="literal">void assertPostConditions()</code></td><td align="left">Override to perform assertions shared by all tests of a test case class. This method is called before the execution of a test ends and before tearDown() is called.</td></tr><tr><td align="left"><code class="literal">void tearDown()</code></td><td align="left">Override to tear down the fixture, for example clean up an object graph.</td></tr></tbody></table></div></div><br class="table-break"></br></div><div class="section" title="PHPUnit_Framework_TestSuite"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="api.testsuite"></a>PHPUnit_Framework_TestSuite</h2></div></div></div><a id="id2584026" class="indexterm"></a><p>
      A <code class="literal">PHPUnit_Framework_TestSuite</code> is a composite of
      <code class="literal">PHPUnit_Framework_Test</code>s. At its simplest, it
      contains a bunch of test cases, all of which are run when the suite is
      run. Since it is a composite, however, a suite can contain suites which
      can contain suites and so on, making it easy to combine tests from
      various sources and run them together.
    </p><p>
      In addition to the <code class="literal">PHPUnit_Framework_Test</code> methods --
      <code class="literal">run(PHPUnit_Framework_TestResult $result)</code> and
      <code class="literal">count()</code> -- <code class="literal">PHPUnit_Framework_TestSuite</code>
      provides methods to create named or unnamed instances.
      <a class="xref" href="api.html#api.testsuite.tables.creating-instances" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.testsuite.tables.creating-instances" title="Table 22.8. Creating named or unnamed instances">Table 22.8</a> shows the
      methods to create <code class="literal">PHPUnit_Framework_TestSuite</code>
      instances.
    </p><div class="table"><a id="api.testsuite.tables.creating-instances"></a><p class="title"><b>Table 22.8. Creating named or unnamed instances</b></p><div class="table-contents"><table summary="Creating named or unnamed instances" border="1"><colgroup><col></col><col></col></colgroup><thead><tr><th align="left">Method</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"><code class="literal">__construct()</code></td><td align="left">Return an empty test suite.</td></tr><tr><td align="left"><code class="literal">__construct(string $theClass)</code></td><td align="left">Return a test suite containing an instance of the class named <code class="literal">$theClass</code> for each method in the class named <code class="literal">test*</code>. If no class of name <code class="literal">$theClass</code> exists an empty test suite named <code class="literal">$theClass</code> is returned.</td></tr><tr><td align="left"><code class="literal">__construct(string $theClass, string $name)</code></td><td align="left">Return a test suite named <code class="literal">$name</code> containing an instance of the class named <code class="literal">$theClass</code> for each method in the class named <code class="literal">test*</code>.</td></tr><tr><td align="left"><code class="literal">__construct(ReflectionClass $theClass)</code></td><td align="left">Return a test suite containing an instance of the class represented by <code class="literal">$theClass</code> for each method in the class named <code class="literal">test*</code>.</td></tr><tr><td align="left"><code class="literal">__construct(ReflectionClass $theClass, $name)</code></td><td align="left">Return a test suite named <code class="literal">$name</code> containing an instance of the class represented by <code class="literal">$theClass</code> for each method in the class named <code class="literal">test*</code>.</td></tr><tr><td align="left"><code class="literal">string getName()</code></td><td align="left">Return the name of the test suite.</td></tr><tr><td align="left"><code class="literal">void setName(string $name)</code></td><td align="left">Set the name of the test suite.</td></tr><tr><td align="left"><code class="literal">void markTestSuiteSkipped(string $message)</code></td><td align="left">Marks the current test suite as being skipped, <code class="literal">$message</code> is optional.</td></tr></tbody></table></div></div><br class="table-break"></br><p>
      <code class="literal">PHPUnit_Framework_TestSuite</code> also provides methods
      for adding and retrieving <code class="literal">PHPUnit_Framework_Test</code>s,
      as shown in <a class="xref" href="api.html#api.testsuite.tables.api" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.testsuite.tables.api" title="Table 22.9. Adding and retrieving tests">Table 22.9</a>.
    </p><div class="table"><a id="api.testsuite.tables.api"></a><p class="title"><b>Table 22.9. Adding and retrieving tests</b></p><div class="table-contents"><table summary="Adding and retrieving tests" border="1"><colgroup><col></col><col></col></colgroup><thead><tr><th align="left">Method</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"><code class="literal">void addTestSuite(PHPUnit_Framework_TestSuite $suite)</code></td><td align="left">Add another test suite to the test suite.</td></tr><tr><td align="left"><code class="literal">void addTestSuite(string $theClass)</code></td><td align="left">Add a test suite containing an instance of the class named <code class="literal">$theClass</code> for each method in the class named <code class="literal">test*</code> to the test suite.</td></tr><tr><td align="left"><code class="literal">void addTestSuite(ReflectionClass $theClass)</code></td><td align="left">Add a test suite containing an instance of the class represented by <code class="literal">$theClass</code> for each method in the class named <code class="literal">test*</code> to the test suite.</td></tr><tr><td align="left"><code class="literal">void addTest(PHPUnit_Framework_Test $test)</code></td><td align="left">Add <code class="literal">$test</code> to the suite.</td></tr><tr><td align="left"><code class="literal">void addTestFile(string $filename)</code></td><td align="left">Add the tests that are defined in the class(es) of a given sourcefile to the suite.</td></tr><tr><td align="left"><code class="literal">void addTestFiles(array $filenames)</code></td><td align="left">Add the tests that are defined in the classes of the given sourcefiles to the suite.</td></tr><tr><td align="left"><code class="literal">int testCount()</code></td><td align="left">Return the number of tests directly (not recursively) in this suite.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Test[] tests()</code></td><td align="left">Return the tests directly in this suite.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_Test testAt(int $index)</code></td><td align="left">Return the test at the <code class="literal">$index</code>.</td></tr></tbody></table></div></div><br class="table-break"></br><p>
      <a class="xref" href="api.html#api.testsuite.examples.TestSuite-example.php" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.testsuite.examples.TestSuite-example.php" title="Example 22.38: Creating and running a test suite">Example 22.38</a> shows
      how to create and run a test suite.
    </p><div class="example"><a id="api.testsuite.examples.TestSuite-example.php"></a><p class="title"><b>Example 22.38: Creating and running a test suite</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">require_once</span><span class="default">&nbsp;</span><span class="string">'PHPUnit/Framework.php'</span><span class="keyword">;</span><br />&nbsp;<br /><span class="keyword">require_once</span><span class="default">&nbsp;</span><span class="string">'ArrayTest.php'</span><span class="keyword">;</span><br />&nbsp;<br /><span class="comment">//&nbsp;Create&nbsp;a&nbsp;test&nbsp;suite&nbsp;that&nbsp;contains&nbsp;the&nbsp;tests</span><br /><span class="comment">//&nbsp;from&nbsp;the&nbsp;ArrayTest&nbsp;class.</span><br /><span class="default">$suite</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">new</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Framework_TestSuite</span><span class="keyword">(</span><span class="string">'ArrayTest'</span><span class="keyword">)</span><span class="keyword">;</span><br />&nbsp;<br /><span class="comment">//&nbsp;Run&nbsp;the&nbsp;tests.</span><br /><span class="default">$suite</span><span class="keyword">-&gt;</span><span class="default">run</span><span class="keyword">(</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">?&gt;</span><br /></code></pre></div></div><br class="example-break"></br><p>
      <a class="xref" href="organizing-tests.html" tppabs="http://www.phpunit.de/manual/current/en/organizing-tests.html" title="Chapter 7. Organizing Tests">Chapter 7</a> shows how to use the
      <code class="literal">PHPUnit_Framework_TestSuite</code> class to
      organize test suites by hierarchically composing test cases.
    </p><p>
      The <code class="literal">PHPUnit_Framework_TestSuite</code> class provides two
      template methods -- <code class="literal">setUp()</code> and
      <code class="literal">tearDown()</code> -- that are called before and after the
      tests of a test suite are run, respectively.
    </p><div class="table"><a id="api.testsuite.tables.template-methods"></a><p class="title"><b>Table 22.10. Template Methods</b></p><div class="table-contents"><table summary="Template Methods" border="1"><colgroup><col></col><col></col></colgroup><thead><tr><th align="left">Method</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"><code class="literal">void setUp()</code></td><td align="left">Called before the first test of the test suite is run.</td></tr><tr><td align="left"><code class="literal">void tearDown()</code></td><td align="left">Called after the last test of the test suite has been run.</td></tr></tbody></table></div></div><br class="table-break"></br></div><div class="section" title="PHPUnit_Framework_TestResult"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="api.testresult"></a>PHPUnit_Framework_TestResult</h2></div></div></div><a id="id2584760" class="indexterm"></a><p>
      While you are running all these tests, you need somewhere to store all
      the results: how many tests ran, which failed, and how long they took.
      <code class="literal">PHPUnit_Framework_TestResult</code> collects these results.
      A single <code class="literal">PHPUnit_Framework_TestResult</code> is passed
      around the whole tree of tests; when a test runs or fails, the fact is
      noted in the <code class="literal">PHPUnit_Framework_TestResult</code>. At the
      end of the run, <code class="literal">PHPUnit_Framework_TestResult</code>
      contains a summary of all the tests.
    </p><p>
      <code class="literal">PHPUnit_Framework_TestResult</code> is also a subject than
      can be observed by other objects wanting to report test progress. For
      example, a graphical test runner might observe the
      <code class="literal">PHPUnit_Framework_TestResult</code> and update a progress
      bar every time a test starts.
    </p><p>
      <a class="xref" href="api.html#api.testresult.tables.api" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.testresult.tables.api" title="Table 22.11. TestResult">Table 22.11</a> summarizes
      the API of <code class="literal">PHPUnit_Framework_TestResult</code>.
    </p><div class="table"><a id="api.testresult.tables.api"></a><p class="title"><b>Table 22.11. TestResult</b></p><div class="table-contents"><table summary="TestResult" border="1"><colgroup><col></col><col></col></colgroup><thead><tr><th align="left">Method</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"><code class="literal">void addError(PHPUnit_Framework_Test $test, Exception $e)</code></td><td align="left">Record that running <code class="literal">$test</code> caused <code class="literal">$e</code> to be thrown unexpectedly.</td></tr><tr><td align="left"><code class="literal">void addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e)</code></td><td align="left">Record that running <code class="literal">$test</code> caused <code class="literal">$e</code> to be thrown unexpectedly.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_TestFailure[] errors()</code></td><td align="left">Return the errors recorded.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_TestFailure[] failures()</code></td><td align="left">Return the failures recorded.</td></tr><tr><td align="left"><code class="literal">PHPUnit_Framework_TestFailure[] notImplemented()</code></td><td align="left">Return the incomplete test cases recorded.</td></tr><tr><td align="left"><code class="literal">int errorCount()</code></td><td align="left">Return the number of errors.</td></tr><tr><td align="left"><code class="literal">int failureCount()</code></td><td align="left">Return the number of failures.</td></tr><tr><td align="left"><code class="literal">int notImplementedCount()</code></td><td align="left">Return the number of incomplete test cases.</td></tr><tr><td align="left"><code class="literal">int count()</code></td><td align="left">Return the total number of test cases run.</td></tr><tr><td align="left"><code class="literal">boolean wasSuccessful()</code></td><td align="left">Return whether or not all tests ran successfully.</td></tr><tr><td align="left"><code class="literal">boolean allCompletlyImplemented()</code></td><td align="left">Return whether or not all tests were completely implemented.</td></tr><tr><td align="left"><code class="literal">void collectCodeCoverageInformation(bool $flag)</code></td><td align="left">Enables or disables the collection of Code Coverage information.</td></tr><tr><td align="left"><code class="literal">array getCodeCoverageInformation()</code></td><td align="left">Return the code coverage information collected.</td></tr></tbody></table></div></div><br class="table-break"></br><p>
      <a id="id2585090" class="indexterm"></a>
      <a id="id2585097" class="indexterm"></a>

      If you want to register as an observer of a
      <code class="literal">PHPUnit_Framework_TestResult</code>, you need to implement
      <code class="literal">PHPUnit_Framework_TestListener</code>. To register, call
      <code class="literal">addListener()</code>, as shown in
      <a class="xref" href="api.html#api.testresult.tables.testresult-testlistener" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.testresult.tables.testresult-testlistener" title="Table 22.12. TestResult and TestListener">Table 22.12</a>.
    </p><div class="table"><a id="api.testresult.tables.testresult-testlistener"></a><p class="title"><b>Table 22.12. TestResult and TestListener</b></p><div class="table-contents"><table summary="TestResult and TestListener" border="1"><colgroup><col></col><col></col></colgroup><thead><tr><th align="left">Method</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"><code class="literal">void addListener(PHPUnit_Framework_TestListener $listener)</code></td><td align="left">Register <code class="literal">$listener</code> to receive updates as results are recorded in the test result.</td></tr><tr><td align="left"><code class="literal">void removeListener(PHPUnit_Framework_TestListener $listener)</code></td><td align="left">Unregister <code class="literal">$listener</code> from receiving updates.</td></tr></tbody></table></div></div><br class="table-break"></br><p>
      <a class="xref" href="api.html#api.testresult.tables.testlistener" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.testresult.tables.testlistener" title="Table 22.13. TestListener Callbacks">Table 22.13</a> shows the methods
      that test listeners implement; also see
      <a class="xref" href="extending-phpunit.html#extending-phpunit.examples.SimpleTestListener.php" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.examples.SimpleTestListener.php" title="Example 23.3: A simple test listener">Example 23.3</a>.
    </p><div class="table"><a id="api.testresult.tables.testlistener"></a><p class="title"><b>Table 22.13. TestListener Callbacks</b></p><div class="table-contents"><table summary="TestListener Callbacks" border="1"><colgroup><col></col><col></col></colgroup><thead><tr><th align="left">Method</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"><code class="literal">void addError(PHPUnit_Framework_Test $test, Exception $e)</code></td><td align="left"><code class="literal">$test</code> has thrown <code class="literal">$e</code>.</td></tr><tr><td align="left"><code class="literal">void addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e)</code></td><td align="left"><code class="literal">$test</code> has failed an assertion, throwing a kind of <code class="literal">PHPUnit_Framework_AssertionFailedError</code>.</td></tr><tr><td align="left"><code class="literal">void addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e)</code></td><td align="left"><code class="literal">$test</code> is an incomplete test.</td></tr><tr><td align="left"><code class="literal">void addSkippedTest(PHPUnit_Framework_Test $test, Exception $e)</code></td><td align="left"><code class="literal">$test</code> is a test that has been skipped.</td></tr><tr><td align="left"><code class="literal">void startTestSuite(PHPUnit_Framework_TestSuite $suite)</code></td><td align="left"><code class="literal">$suite</code> is about to be run.</td></tr><tr><td align="left"><code class="literal">void endTestSuite(PHPUnit_Framework_TestSuite $suite)</code></td><td align="left"><code class="literal">$suite</code> has finished running.</td></tr><tr><td align="left"><code class="literal">void startTest(PHPUnit_Framework_Test $test)</code></td><td align="left"><code class="literal">$test</code> is about to be run.</td></tr><tr><td align="left"><code class="literal">void endTest(PHPUnit_Framework_Test $test)</code></td><td align="left"><code class="literal">$test</code> has finished running.</td></tr></tbody></table></div></div><br class="table-break"></br></div><div class="section" title="Package Structure"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="api.package-structure"></a>Package Structure</h2></div></div></div><p>
      Many of the classes mentioned so far in this book come from
      <code class="literal">PHPUnit/Framework</code>. Here are all the packages in
      PHPUnit:
    </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="literal">PHPUnit/Framework</code></p><p>
          The basic classes in PHPUnit.
        </p></li><li class="listitem"><p><code class="literal">PHPUnit/Extensions</code></p><p>
          Extensions to the PHPUnit framework.
        </p></li><li class="listitem"><p><code class="literal">PHPUnit/Runner</code></p><p>
          Abstract support for running tests.
        </p></li><li class="listitem"><p><code class="literal">PHPUnit/TextUI</code></p><p>
          The text-based test runner.
        </p></li><li class="listitem"><p><code class="literal">PHPUnit/Util</code></p><p>
          Utility classes used by the other packages.
        </p></li></ul></div></div></div>
      <table border="0" width="100%">
        <tr>
          <td align="left"><a accesskey="p" href="continuous-integration.html" tppabs="http://www.phpunit.de/manual/current/en/continuous-integration.html">Prev</a></td>
          <td align="right"><a accesskey="n" href="extending-phpunit.html" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html">Next</a></td>
        </tr>
      </table>
    </div>
    <div class="col2">
<dl><dt><span class="chapter"><a href="automating-tests.html" tppabs="http://www.phpunit.de/manual/current/en/automating-tests.html">1. 自动化测试</a></span></dt><dt><span class="chapter"><a href="goals.html" tppabs="http://www.phpunit.de/manual/current/en/goals.html">2. PHPUnit的目标</a></span></dt><dt><span class="chapter"><a href="installation.html" tppabs="http://www.phpunit.de/manual/current/en/installation.html">3. 安装PHPUnit</a></span></dt><dt><span class="chapter"><a href="writing-tests-for-phpunit.html" tppabs="http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html">4. 为PHPUnit编写测试</a></span></dt><dd><dl><dt><span class="section"><a href="writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers" tppabs="http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers">数据提供者</a></span></dt><dt><span class="section"><a href="writing-tests-for-phpunit.html#writing-tests-for-phpunit.exceptions" tppabs="http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.exceptions">测试异常</a></span></dt><dt><span class="section"><a href="writing-tests-for-phpunit.html#writing-tests-for-phpunit.errors" tppabs="http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.errors">测试PHP错误</a></span></dt></dl></dd><dt><span class="chapter"><a href="textui.html" tppabs="http://www.phpunit.de/manual/current/en/textui.html">5. 命令行测试运行器</a></span></dt><dt><span class="chapter"><a href="fixtures.html" tppabs="http://www.phpunit.de/manual/current/en/fixtures.html">6. Fixtures(固定装置/脚手架)</a></span></dt><dd><dl><dt><span class="section"><a href="fixtures.html#fixtures.more-setup-than-teardown" tppabs="http://www.phpunit.de/manual/current/en/fixtures.html#fixtures.more-setup-than-teardown">setUp()多于tearDown()</a></span></dt><dt><span class="section"><a href="fixtures.html#fixtures.variations" tppabs="http://www.phpunit.de/manual/current/en/fixtures.html#fixtures.variations">变化</a></span></dt><dt><span class="section"><a href="fixtures.html#fixtures.sharing-fixture" tppabs="http://www.phpunit.de/manual/current/en/fixtures.html#fixtures.sharing-fixture">共享Fixture</a></span></dt><dt><span class="section"><a href="fixtures.html#fixtures.global-state" tppabs="http://www.phpunit.de/manual/current/en/fixtures.html#fixtures.global-state">全局状态</a></span></dt></dl></dd><dt><span class="chapter"><a href="organizing-tests.html" tppabs="http://www.phpunit.de/manual/current/en/organizing-tests.html">7. 组织测试</a></span></dt><dd><dl><dt><span class="section"><a href="organizing-tests.html#organizing-tests.filesystem" tppabs="http://www.phpunit.de/manual/current/en/organizing-tests.html#organizing-tests.filesystem">使用文件系统组成一个测试套件</a></span></dt><dt><span class="section"><a href="organizing-tests.html#organizing-tests.xml-configuration" tppabs="http://www.phpunit.de/manual/current/en/organizing-tests.html#organizing-tests.xml-configuration">使用XML配置文件组成一个测试套件</a></span></dt><dt><span class="section"><a href="organizing-tests.html#organizing-tests.testsuite" tppabs="http://www.phpunit.de/manual/current/en/organizing-tests.html#organizing-tests.testsuite">使用TestSuite类</a></span></dt></dl></dd><dt><span class="chapter"><a href="testcase-extensions.html" tppabs="http://www.phpunit.de/manual/current/en/testcase-extensions.html">8. 测试用例异常</a></span></dt><dd><dl><dt><span class="section"><a href="testcase-extensions.html#testcase-extensions.output" tppabs="http://www.phpunit.de/manual/current/en/testcase-extensions.html#testcase-extensions.output">测试输出</a></span></dt><dt><span class="section"><a href="testcase-extensions.html#testcase-extensions.performance" tppabs="http://www.phpunit.de/manual/current/en/testcase-extensions.html#testcase-extensions.performance">测试性能</a></span></dt></dl></dd><dt><span class="chapter"><a href="database.html" tppabs="http://www.phpunit.de/manual/current/en/database.html">9. 数据库测试</a></span></dt><dd><dl><dt><span class="section"><a href="database.html#database.datasets" tppabs="http://www.phpunit.de/manual/current/en/database.html#database.datasets">数据集合设置</a></span></dt><dd><dl><dt><span class="section"><a href="database.html#database.datasets.flatxml" tppabs="http://www.phpunit.de/manual/current/en/database.html#database.datasets.flatxml">单层XML数据集</a></span></dt><dt><span class="section"><a href="database.html#database.datasets.xml" tppabs="http://www.phpunit.de/manual/current/en/database.html#database.datasets.xml">XML数据集</a></span></dt><dt><span class="section"><a href="database.html#database.datasets.csv" tppabs="http://www.phpunit.de/manual/current/en/database.html#database.datasets.csv">CSV数据集</a></span></dt><dt><span class="section"><a href="database.html#database.datasets.replacement" tppabs="http://www.phpunit.de/manual/current/en/database.html#database.datasets.replacement">Replacement Data Set</a></span></dt></dl></dd><dt><span class="section"><a href="database.html#database.operations" tppabs="http://www.phpunit.de/manual/current/en/database.html#database.operations">操作</a></span></dt><dt><span class="section"><a href="database.html#database.bestpractices" tppabs="http://www.phpunit.de/manual/current/en/database.html#database.bestpractices">数据库测试最佳实践</a></span></dt></dl></dd><dt><span class="chapter"><a href="incomplete-and-skipped-tests.html" tppabs="http://www.phpunit.de/manual/current/en/incomplete-and-skipped-tests.html">10. 未完成和跳过的测试</a></span></dt><dd><dl><dt><span class="section"><a href="incomplete-and-skipped-tests.html#incomplete-and-skipped-tests.incomplete-tests" tppabs="http://www.phpunit.de/manual/current/en/incomplete-and-skipped-tests.html#incomplete-and-skipped-tests.incomplete-tests">未完成的测试</a></span></dt><dt><span class="section"><a href="incomplete-and-skipped-tests.html#incomplete-and-skipped-tests.skipping-tests" tppabs="http://www.phpunit.de/manual/current/en/incomplete-and-skipped-tests.html#incomplete-and-skipped-tests.skipping-tests">跳过的测试</a></span></dt></dl></dd><dt><span class="chapter"><a href="test-doubles.html" tppabs="http://www.phpunit.de/manual/current/en/test-doubles.html">11. Test Doubles(测试模拟者)</a></span></dt><dd><dl><dt><span class="section"><a href="test-doubles.html#test-doubles.stubs" tppabs="http://www.phpunit.de/manual/current/en/test-doubles.html#test-doubles.stubs">Stubs</a></span></dt><dt><span class="section"><a href="test-doubles.html#test-doubles.mock-objects" tppabs="http://www.phpunit.de/manual/current/en/test-doubles.html#test-doubles.mock-objects">模拟对象</a></span></dt><dt><span class="section"><a href="test-doubles.html#test-doubles.mocking-the-filesystem" tppabs="http://www.phpunit.de/manual/current/en/test-doubles.html#test-doubles.mocking-the-filesystem">模拟文件系统</a></span></dt></dl></dd><dt><span class="chapter"><a href="testing-practices.html" tppabs="http://www.phpunit.de/manual/current/en/testing-practices.html">12. 测试实践</a></span></dt><dd><dl><dt><span class="section"><a href="testing-practices.html#testing-practices.during-development" tppabs="http://www.phpunit.de/manual/current/en/testing-practices.html#testing-practices.during-development">开发期间</a></span></dt><dt><span class="section"><a href="testing-practices.html#testing-practices.during-debugging" tppabs="http://www.phpunit.de/manual/current/en/testing-practices.html#testing-practices.during-debugging">调试期间</a></span></dt></dl></dd><dt><span class="chapter"><a href="test-driven-development.html" tppabs="http://www.phpunit.de/manual/current/en/test-driven-development.html">13. 测试驱动开发</a></span></dt><dd><dl><dt><span class="section"><a href="test-driven-development.html#test-driven-development.bankaccount-example" tppabs="http://www.phpunit.de/manual/current/en/test-driven-development.html#test-driven-development.bankaccount-example">银行账户例子</a></span></dt></dl></dd><dt><span class="chapter"><a href="behaviour-driven-development.html" tppabs="http://www.phpunit.de/manual/current/en/behaviour-driven-development.html">14. 行为驱动开发</a></span></dt><dd><dl><dt><span class="section"><a href="behaviour-driven-development.html#behaviour-driven-development.bowlinggame-example" tppabs="http://www.phpunit.de/manual/current/en/behaviour-driven-development.html#behaviour-driven-development.bowlinggame-example">保龄球运动例子</a></span></dt></dl></dd><dt><span class="chapter"><a href="code-coverage-analysis.html" tppabs="http://www.phpunit.de/manual/current/en/code-coverage-analysis.html">15. 代码覆盖测试</a></span></dt><dd><dl><dt><span class="section"><a href="code-coverage-analysis.html#code-coverage-analysis.specifying-covered-methods" tppabs="http://www.phpunit.de/manual/current/en/code-coverage-analysis.html#code-coverage-analysis.specifying-covered-methods">指定覆盖方法</a></span></dt><dt><span class="section"><a href="code-coverage-analysis.html#code-coverage-analysis.ignoring-code-blocks" tppabs="http://www.phpunit.de/manual/current/en/code-coverage-analysis.html#code-coverage-analysis.ignoring-code-blocks">忽略代码块</a></span></dt><dt><span class="section"><a href="code-coverage-analysis.html#code-coverage-analysis.including-excluding-files" tppabs="http://www.phpunit.de/manual/current/en/code-coverage-analysis.html#code-coverage-analysis.including-excluding-files">包含和非包含文件</a></span></dt></dl></dd><dt><span class="chapter"><a href="other-uses-for-tests.html" tppabs="http://www.phpunit.de/manual/current/en/other-uses-for-tests.html">16. 测试的其他用途</a></span></dt><dd><dl><dt><span class="section"><a href="other-uses-for-tests.html#other-uses-for-tests.agile-documentation" tppabs="http://www.phpunit.de/manual/current/en/other-uses-for-tests.html#other-uses-for-tests.agile-documentation">灵活的文档</a></span></dt><dt><span class="section"><a href="other-uses-for-tests.html#other-uses-for-tests.cross-team-tests" tppabs="http://www.phpunit.de/manual/current/en/other-uses-for-tests.html#other-uses-for-tests.cross-team-tests">Cross-Team Tests</a></span></dt></dl></dd><dt><span class="chapter"><a href="skeleton-generator.html" tppabs="http://www.phpunit.de/manual/current/en/skeleton-generator.html">17. 框架生成器</a></span></dt><dd><dl><dt><span class="section"><a href="skeleton-generator.html#skeleton-generator.test" tppabs="http://www.phpunit.de/manual/current/en/skeleton-generator.html#skeleton-generator.test">生成一个测试用例框架</a></span></dt><dt><span class="section"><a href="skeleton-generator.html#skeleton-generator.class" tppabs="http://www.phpunit.de/manual/current/en/skeleton-generator.html#skeleton-generator.class">从一个测试用例生成类</a></span></dt></dl></dd><dt><span class="chapter"><a href="javascript:if(confirm('http://www.phpunit.de/manual/current/en/selenium.html  \n\nļδ Teleport Pro ȡأΪ ޷ȡãȡغĿֹ̫ͣ졣  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/current/en/selenium.html'" tppabs="http://www.phpunit.de/manual/current/en/selenium.html">18. PHPUnit and Selenium</a></span></dt><dd><dl><dt><span class="section"><a href="javascript:if(confirm('http://www.phpunit.de/manual/current/en/selenium.html  \n\nļδ Teleport Pro ȡأΪ ޷ȡãȡغĿֹ̫ͣ졣  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/current/en/selenium.html#selenium.selenium-rc'" tppabs="http://www.phpunit.de/manual/current/en/selenium.html#selenium.selenium-rc">Selenium RC</a></span></dt><dt><span class="section"><a href="javascript:if(confirm('http://www.phpunit.de/manual/current/en/selenium.html  \n\nļδ Teleport Pro ȡأΪ ޷ȡãȡغĿֹ̫ͣ졣  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/current/en/selenium.html#selenium.seleniumtestcase'" tppabs="http://www.phpunit.de/manual/current/en/selenium.html#selenium.seleniumtestcase">PHPUnit_Extensions_SeleniumTestCase</a></span></dt></dl></dd><dt><span class="chapter"><a href="logging.html" tppabs="http://www.phpunit.de/manual/current/en/logging.html">19. 日志</a></span></dt><dd><dl><dt><span class="section"><a href="logging.html#logging.xml" tppabs="http://www.phpunit.de/manual/current/en/logging.html#logging.xml">测试结果(XML)</a></span></dt><dt><span class="section"><a href="logging.html#logging.tap" tppabs="http://www.phpunit.de/manual/current/en/logging.html#logging.tap">测试结果 (TAP)</a></span></dt><dt><span class="section"><a href="logging.html#logging.json" tppabs="http://www.phpunit.de/manual/current/en/logging.html#logging.json">测试结果 (JSON)</a></span></dt><dt><span class="section"><a href="logging.html#logging.codecoverage" tppabs="http://www.phpunit.de/manual/current/en/logging.html#logging.codecoverage">代码覆盖 (XML)</a></span></dt><dt><span class="section"><a href="logging.html#logging.database" tppabs="http://www.phpunit.de/manual/current/en/logging.html#logging.database">测试数据库</a></span></dt></dl></dd><dt><span class="chapter"><a href="build-automation.html" tppabs="http://www.phpunit.de/manual/current/en/build-automation.html">20. 自动化构建</a></span></dt><dd><dl><dt><span class="section"><a href="build-automation.html#build-automation.ant" tppabs="http://www.phpunit.de/manual/current/en/build-automation.html#build-automation.ant">Apache Ant</a></span></dt><dt><span class="section"><a href="build-automation.html#build-automation.maven" tppabs="http://www.phpunit.de/manual/current/en/build-automation.html#build-automation.maven">Apache Maven</a></span></dt><dt><span class="section"><a href="build-automation.html#build-automation.phing" tppabs="http://www.phpunit.de/manual/current/en/build-automation.html#build-automation.phing">Phing</a></span></dt></dl></dd><dt><span class="chapter"><a href="continuous-integration.html" tppabs="http://www.phpunit.de/manual/current/en/continuous-integration.html">21. 连续集成</a></span></dt><dd><dl><dt><span class="section"><a href="continuous-integration.html#continuous-integration.atlassian-bamboo" tppabs="http://www.phpunit.de/manual/current/en/continuous-integration.html#continuous-integration.atlassian-bamboo">Atlassian Bamboo</a></span></dt><dt><span class="section"><a href="continuous-integration.html#continuous-integration.cruisecontrol" tppabs="http://www.phpunit.de/manual/current/en/continuous-integration.html#continuous-integration.cruisecontrol">CruiseControl</a></span></dt><dt><span class="section"><a href="continuous-integration.html#continuous-integration.phpUnderControl" tppabs="http://www.phpunit.de/manual/current/en/continuous-integration.html#continuous-integration.phpUnderControl">phpUnderControl</a></span></dt></dl></dd><dt><span class="chapter"><a href="api.html" tppabs="http://www.phpunit.de/manual/current/en/api.html">22. PHPUnit API</a></span></dt><dd><dl><dt><span class="section"><a href="api.html#api.overview" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.overview">概述</a></span></dt><dt><span class="section"><a href="api.html#api.assert" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert">PHPUnit_Framework_Assert</a></span></dt><dd><dl><dt><span class="section"><a href="api.html#api.assert.assertArrayHasKey" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertArrayHasKey"><code class="literal">assertArrayHasKey()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertClassHasAttribute" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertClassHasAttribute"><code class="literal">assertClassHasAttribute()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertClassHasStaticAttribute" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertClassHasStaticAttribute"><code class="literal">assertClassHasStaticAttribute()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertContains" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertContains"><code class="literal">assertContains()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertContainsOnly" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertContainsOnly"><code class="literal">assertContainsOnly()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertEqualXMLStructure" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertEqualXMLStructure"><code class="literal">assertEqualXMLStructure()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertEquals" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertEquals"><code class="literal">assertEquals()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertFalse" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertFalse"><code class="literal">assertFalse()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertFileEquals" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertFileEquals"><code class="literal">assertFileEquals()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertFileExists" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertFileExists"><code class="literal">assertFileExists()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertGreaterThan" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertGreaterThan"><code class="literal">assertGreaterThan()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertGreaterThanOrEqual" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertGreaterThanOrEqual"><code class="literal">assertGreaterThanOrEqual()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertLessThan" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertLessThan"><code class="literal">assertLessThan()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertLessThanOrEqual" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertLessThanOrEqual"><code class="literal">assertLessThanOrEqual()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertNotNull" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertNotNull"><code class="literal">assertNotNull()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertObjectHasAttribute" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertObjectHasAttribute"><code class="literal">assertObjectHasAttribute()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertRegExp" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertRegExp"><code class="literal">assertRegExp()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertSame" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertSame"><code class="literal">assertSame()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertSelectCount" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertSelectCount"><code class="literal">assertSelectCount()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertSelectEquals" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertSelectEquals"><code class="literal">assertSelectEquals()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertSelectRegExp" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertSelectRegExp"><code class="literal">assertSelectRegExp()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertStringEqualsFile" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertStringEqualsFile"><code class="literal">assertStringEqualsFile()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertTag" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertTag"><code class="literal">assertTag()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertThat" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertThat"><code class="literal">assertThat()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertTrue" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertTrue"><code class="literal">assertTrue()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertType" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertType"><code class="literal">assertType()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertXmlFileEqualsXmlFile" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertXmlFileEqualsXmlFile"><code class="literal">assertXmlFileEqualsXmlFile()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertXmlStringEqualsXmlFile" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertXmlStringEqualsXmlFile"><code class="literal">assertXmlStringEqualsXmlFile()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertXmlStringEqualsXmlString" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertXmlStringEqualsXmlString"><code class="literal">assertXmlStringEqualsXmlString()</code></a></span></dt></dl></dd><dt><span class="section"><a href="api.html#api.test" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.test">PHPUnit_Framework_Test</a></span></dt><dt><span class="section"><a href="api.html#api.testcase" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.testcase">PHPUnit_Framework_TestCase</a></span></dt><dt><span class="section"><a href="api.html#api.testsuite" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.testsuite">PHPUnit_Framework_TestSuite</a></span></dt><dt><span class="section"><a href="api.html#api.testresult" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.testresult">PHPUnit_Framework_TestResult</a></span></dt><dt><span class="section"><a href="api.html#api.package-structure" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.package-structure">Package Structure</a></span></dt></dl></dd><dt><span class="chapter"><a href="extending-phpunit.html" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html">23. 扩展 PHPUnit</a></span></dt><dd><dl><dt><span class="section"><a href="extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestCase" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestCase">Subclass PHPUnit_Framework_TestCase</a></span></dt><dt><span class="section"><a href="extending-phpunit.html#extending-phpunit.Assert" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.Assert">Assert Classes</a></span></dt><dt><span class="section"><a href="extending-phpunit.html#extending-phpunit.PHPUnit_Extensions_TestDecorator" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.PHPUnit_Extensions_TestDecorator">Subclass PHPUnit_Extensions_TestDecorator</a></span></dt><dt><span class="section"><a href="extending-phpunit.html#extending-phpunit.PHPUnit_Framework_Test" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.PHPUnit_Framework_Test">Implement PHPUnit_Framework_Test</a></span></dt><dt><span class="section"><a href="extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestResult" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestResult">Subclass PHPUnit_Framework_TestResult</a></span></dt><dt><span class="section"><a href="extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestListener" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestListener">Implement PHPUnit_Framework_TestListener</a></span></dt><dt><span class="section"><a href="extending-phpunit.html#extending-phpunit.TestRunner" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.TestRunner">New Test Runner</a></span></dt></dl></dd><dt><span class="appendix"><a href="appendixes.assertions.html" tppabs="http://www.phpunit.de/manual/current/en/appendixes.assertions.html">A. 断言</a></span></dt><dt><span class="appendix"><a href="appendixes.configuration.html" tppabs="http://www.phpunit.de/manual/current/en/appendixes.configuration.html">B. XML配置文件</a></span></dt><dd><dl><dt><span class="section"><a href="appendixes.configuration.html#appendixes.configuration.phpunit" tppabs="http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.phpunit">PHPUnit</a></span></dt><dt><span class="section"><a href="appendixes.configuration.html#appendixes.configuration.testsuite" tppabs="http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.testsuite">测试套件</a></span></dt><dt><span class="section"><a href="appendixes.configuration.html#appendixes.configuration.groups" tppabs="http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.groups">Groups</a></span></dt><dt><span class="section"><a href="appendixes.configuration.html#appendixes.configuration.blacklist-whitelist" tppabs="http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.blacklist-whitelist">代码中的包含文件和排除文件</a></span></dt><dt><span class="section"><a href="appendixes.configuration.html#appendixes.configuration.logging" tppabs="http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.logging">Logging</a></span></dt><dt><span class="section"><a href="appendixes.configuration.html#appendixes.configuration.php-ini-constants-variables" tppabs="http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.php-ini-constants-variables">Setting PHP INI settings, Constants and Global Variables</a></span></dt><dt><span class="section"><a href="appendixes.configuration.html#appendixes.configuration.selenium-rc" tppabs="http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.selenium-rc">Configuring Browsers for Selenium RC</a></span></dt></dl></dd><dt><span class="appendix"><a href="appendixes.index.html" tppabs="http://www.phpunit.de/manual/current/en/appendixes.index.html">C. 索引</a></span></dt><dd><dl><dt><span class="index"><a href="appendixes.index.html#appendixes.index.index" tppabs="http://www.phpunit.de/manual/current/en/appendixes.index.html#appendixes.index.index"></a></span></dt></dl></dd><dt><span class="appendix"><a href="appendixes.bibliography.html" tppabs="http://www.phpunit.de/manual/current/en/appendixes.bibliography.html">D. 文献</a></span></dt><dt><span class="appendix"><a href="appendixes.copyright.html" tppabs="http://www.phpunit.de/manual/current/en/appendixes.copyright.html">E. 版权</a></span></dt></dl>
    </div>
  </div>
</div>
<div id="footer">
  <p><a href="appendixes.copyright.html" tppabs="http://www.phpunit.de/manual/current/en/appendixes.copyright.html">Copyright</a> &copy; 2005-2009 <a href="javascript:if(confirm('http://sebastian-bergmann.de/  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://sebastian-bergmann.de/'" tppabs="http://sebastian-bergmann.de/">Sebastian Bergmann</a>.</p>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www./");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-68261-7");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>

